Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


dont know where this should go but need help

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,62152
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> dont know where this should go but need help
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 dont know where this should go but need help - 7/3/2008 5:18:00 AM   
  jlusco

 

Posts: 2
Score: 0
Joined: 7/3/2008
Status: offline
i have this vb script that dose what it is ment to do but i am trying to get it to get the same info just send that info to a text file for latter review if some one could please help


code:

' Check command line parameters
Select Case WScript.Arguments.Count
Case 0
' Default if none specified is local computer (".")
Set objWMIService = GetObject( "winmgmts://./root/cimv2" )
Set colItems = objWMIService.ExecQuery( "Select * from Win32_ComputerSystem", , 48 )
For Each objItem in colItems
 strComputer = objItem.Name
Next
Case 1
' Command line parameter can either be a computer
' name or "/?" to request online help
strComputer = UCase( Wscript.Arguments(0) )
if InStr( strComputer, "?" ) > 0 Then Syntax
Case Else
' Maximum is 1 command line parameter
Syntax
End Select
' Header line for screen output
strMsg = vbCrLf & "Hardware summary for " & strComputer & ":" & vbCrLf & vbCrLf
' Enable error handling
On Error Resume Next
' Connect to specified computer
Set objWMIService = GetObject( "winmgmts://" & strComputer & "/root/cimv2" )
' Display error number and description if applicable
If Err Then ShowError
' Query processor properties
Set colItems = objWMIService.ExecQuery( "Select * from Win32_Processor", , 48 )
' Display error number and description if applicable
If Err Then ShowError
' Prepare display of results
For Each objItem in colItems
strMsg = strMsg & "Processor(s)" & vbCrLf _
      & "    Name:                    " _
      & Strip( objItem.Name ) & vbCrLf _
      & "    Manufacturer:            " _
      & objItem.Manufacturer & vbCrLf _
      & "    Description:             " _
      & objItem.Description & vbCrLf _
      & "    Current Clock Speed:     " _
      & objItem.CurrentClockSpeed & " MHz" _
      & vbCrLf & vbCrLf
Next
' Query memory properties
Set colItems = objWMIService.ExecQuery( "Select * from Win32_LogicalMemoryConfiguration", , 48 )
' Display error number and description if applicable
If Err Then ShowError
' Prepare display of results
For Each objItem in colItems
strMsg = strMsg & "Memory" & vbCrLf _
      & "    Total Physical Memory:   " _
      & Int( ( objItem.TotalPhysicalMemory + 1023 ) / 1024 ) _
      & " MB" & vbCrLf & vbCrLf
Next
' Query harddisk properties
Set colItems = objWMIService.ExecQuery( "Select * from Win32_DiskDrive", , 48 )
' Display error number and description if applicable
If Err Then ShowError
' Prepare display of results
For Each objItem in colItems
strMsg = strMsg & "Harddisk(s)" & vbCrLf _
      & "    Manufacturer:            " _
      & objItem.Manufacturer & vbCrLf _
      & "    Model:                   " _
      & objItem.Model & vbCrLf _
      & "    Size:                    " _
      & Int( ( objItem.Size + 536870912 ) / 1073741824 ) _
      & " GB" & vbCrLf & vbCrLf
Next
' Query video adapter properties
Set colItems = objWMIService.ExecQuery( "Select * from Win32_VideoController", , 48 )
' Display error number and description if applicable
If Err Then ShowError
' Prepare display of results
For Each objItem in colItems
strMsg = strMsg & "Video" & vbCrLf _
      & "    Name:                    " _
      & objItem.Name & vbCrLf _
      & "    Description:             " _
      & objItem.Description & vbCrLf _
      & "    Video Processor:         " _
      & objItem.VideoProcessor & vbCrLf _
      & "    Adapter RAM:             " _
      & Int( ( objItem.AdapterRAM + 524288 ) / 1048576 ) _
      & " MB" & vbCrLf _
      & "    Video Mode Description:  " _
      & objItem.VideoModeDescription & vbCrLf & vbCrLf
Next
' Display results
WScript.Echo strMsg
'Done
WScript.Quit(0)

Sub ShowError()
strMsg = vbCrLf & "Error # " & Err.Number & vbCrLf & _
        Err.Description & vbCrLf & vbCrLf
Syntax
End Sub

Sub Syntax()
strMsg = strMsg & vbCrLf _
      & "Hardware.vbs,  Version 1.11" & vbCrLf _
      & "Display basic hardware summary for " _
      & "any computer on the network" & vbCrLf & vbCrLf _
      & "Usage:  CSCRIPT  //NOLOGO  HARDWARE.VBS  " _
      & "[ computer_name ]" & vbCrLf & vbCrLf _
      & "Where:  " & Chr(34) & "computer_name" & Chr(34) _
      & " is the optional name of a remote" & vbCrLf _
      & "        computer (default is local computer " _
      & "name)" & vbCrLf & vbCrLf _
      & "Written by Rob van der Woude" & vbCrLf _
       & "http://www.robvanderwoude.com" & vbCrLf & vbCrLf _
       & "Created with Microsoft's Scriptomatic tool" & vbCrLf _
       & "http://www.microsoft.com/technet/treeview/default.asp" _
       & "?url=/technet/scriptcenter/WMImatic.asp" & vbCrLf
       WScript.Echo strMsg
WScript.Quit(1)
End Sub

Private Function Strip( strInput )
Do While Left( strInput, 1 ) = " "
strInput = Mid( strInput, 2 )
Loop
Strip = strInput
End Function

or if some one has something that will do what i need to replace this one
thank you

< Message edited by jlusco -- 7/3/2008 5:21:08 AM >
 
 
Post #: 1
 
 RE: dont know where this should go but need help - 7/3/2008 5:28:54 AM   
  ehvbs

 

Posts: 2078
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi jlusco,

does calling your script like this:

  CSCRIPT  //NOLOGO  HARDWARE.VBS >result.txt

solve your problem?

Good luck!

ehvbs

(in reply to jlusco)
 
 
Post #: 2
 
 RE: dont know where this should go but need help - 7/3/2008 10:35:45 AM   
  jlusco

 

Posts: 2
Score: 0
Joined: 7/3/2008
Status: offline
you rock that worked thanks

now i have to find away o take 5 batch files and 3 vbscripts and make them on stand alown exe

< Message edited by jlusco -- 7/3/2008 11:33:35 AM >

(in reply to ehvbs)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> dont know where this should go but need help Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts