Sign in to follow this  
Followers 0
ioliver

System Information Script

5 posts in this topic

I've written a small script to get System Information for a comptuer on your network. It's tested on my network and works pretty well. Check it out when you can: http://www.autoitscript.com/fileman/index.php?dir=ioliver

Here is the source code:

; System Information.AU3
; Ian Oliver
; September 23, 2004

Global $host
Global $make
Global $model
Global $processortype
Global $processorspeed
Global $memory
$host = InputBox("System Information (AU3)", "Host Name?")
Call("PSInfo")
Call("MakeModel")
$txt_Report = FileOpen("c:\SIR.txt", 2)
FileWriteLine($txt_Report, "Host Name: " & $host & "")
FileWriteLine($txt_Report, "")
FileWriteLine($txt_Report, "Make:      " & $make & "")
FileWriteLine($txt_Report, "Model:     " & $model & "")
FileWriteLine($txt_Report, "Processor: " & $processortype & "")
FileWriteLine($txt_Report, "Speed:     " & $processorspeed & "")
FileWriteLine($txt_Report, "Memory:    " & $memory & "")
FileClose($txt_Report)
Call("Cleanup")
$varOpenSIR = MsgBox(4, "System Information (AU3 + a little VBS)", "Complete!  Open the Report?")
If $varOpenSIR = 6 Then
  Run("Notepad.exe c:\SIR.txt")
EndIf

Func PSInfo()
  FileInstall("c:\psinfo\psinfo.exe", "c:\psinfo.exe")
  FileInstall("c:\psinfo\pdh.dll", "c:\pdh.dll")
  RunWait(@ComSpec & ' /c c:\psinfo.exe -c "\\' & $host & '" > c:\psinfo.txt', 'c:\', @SW_HIDE)
  $txt_psinfo = FileReadLine("c:\psinfo.txt")
  $array_psinfo = StringSplit($txt_psinfo, ",")
 ; PSInfo Variables
  $processorspeed = $array_psinfo[17]
  $processortype  = $array_psinfo[18]
  $memory         = $array_psinfo[19]
EndFunc

Func MakeModel()
  $vbs = FileOpen("c:\MakeModel.vbs", 2)
  FileWriteLine($vbs, "")
  FileWriteLine($vbs, "On Error Resume Next")
  FileWriteLine($vbs, 'Set FSO = CreateObject("Scripting.FileSystemObject")')
  FileWriteLine($vbs, 'Set MakeModel = FSO.CreateTextFile("c:\MakeModel.txt", True)')
  FileWriteLine($vbs, 'strComputer = "' & $host & '"')
  FileWriteLine($vbs, 'Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")')
  FileWriteLine($vbs, 'Set colItems2 = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)')
  FileWriteLine($vbs, "")
  FileWriteLine($vbs, "For Each objItem in colItems2")
  FileWriteLine($vbs, "")
  FileWriteLine($vbs, "Make = objItem.Manufacturer")
  FileWriteLine($vbs, "Model = objItem.Model")
  FileWriteLine($vbs, "MakeModel.WriteLine Make")
  FileWriteLine($vbs, "MakeModel.WriteLine Model")
  FileWriteLine($vbs, "")
  FileWriteLine($vbs, "Next")
  FileClose($vbs)
  Run("wscript.exe c:\MakeModel.vbs")
  $txt_MakeModel = FileOpen("c:\MakeModel.txt", 0)
 ; MakeModel Variables
  $make  = FileReadLine($txt_MakeModel, 1)
  $model = FileReadLine($txt_MakeModel, 2)
  FileClose($txt_MakeModel)
EndFunc

Func Cleanup()
  FileDelete("c:\psinfo.exe")
  FileDelete("c:\pdh.dll")
  FileDelete("c:\psinfo.txt")
 ;FileDelete("c:\MakeModel.vbs")
  FileDelete("c:\MakeModel.txt")
EndFunc

I'm sure it could use some work, but I'm proud of it.

Ian


"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Share this post


Link to post
Share on other sites



---------------------------

AutoIt Error

---------------------------

$processorspeed = $array_psinfo[17]

$processorspeed = ^ ERROR

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.

Share this post


Link to post
Share on other sites

---------------------------

AutoIt Error

---------------------------

$processorspeed = $array_psinfo[17]

$processorspeed = ^ ERROR

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.

<{POST_SNAPBACK}>

Did you download the compiled script or just run the script form the source? You could get that error message if you don't use the compiled script because psinfo.exe needs to be fileinstall()ed.

Ian


"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Share this post


Link to post
Share on other sites

Is the URL provided required username and password to login ?

where can I register or how can I login ? :)

I've written a small script to get System Information for a comptuer on your network.  It's tested on my network and works pretty well.  Check it out when you can: http://www.autoitscript.com/fileman/index.php?dir=ioliver

Here is the source code:

; System Information.AU3
; Ian Oliver
; September 23, 2004

Global $host
Global $make
Global $model
Global $processortype
Global $processorspeed
Global $memory
$host = InputBox("System Information (AU3)", "Host Name?")
Call("PSInfo")
Call("MakeModel")
$txt_Report = FileOpen("c:\SIR.txt", 2)
FileWriteLine($txt_Report, "Host Name: " & $host & "")
FileWriteLine($txt_Report, "")
FileWriteLine($txt_Report, "Make:      " & $make & "")
FileWriteLine($txt_Report, "Model:     " & $model & "")
FileWriteLine($txt_Report, "Processor: " & $processortype & "")
FileWriteLine($txt_Report, "Speed:     " & $processorspeed & "")
FileWriteLine($txt_Report, "Memory:    " & $memory & "")
FileClose($txt_Report)
Call("Cleanup")
$varOpenSIR = MsgBox(4, "System Information (AU3 + a little VBS)", "Complete!  Open the Report?")
If $varOpenSIR = 6 Then
  Run("Notepad.exe c:\SIR.txt")
EndIf

Func PSInfo()
  FileInstall("c:\psinfo\psinfo.exe", "c:\psinfo.exe")
  FileInstall("c:\psinfo\pdh.dll", "c:\pdh.dll")
  RunWait(@ComSpec & ' /c c:\psinfo.exe -c "\\' & $host & '" > c:\psinfo.txt', 'c:\', @SW_HIDE)
  $txt_psinfo = FileReadLine("c:\psinfo.txt")
  $array_psinfo = StringSplit($txt_psinfo, ",")
; PSInfo Variables
  $processorspeed = $array_psinfo[17]
  $processortype  = $array_psinfo[18]
  $memory         = $array_psinfo[19]
EndFunc

Func MakeModel()
  $vbs = FileOpen("c:\MakeModel.vbs", 2)
  FileWriteLine($vbs, "")
  FileWriteLine($vbs, "On Error Resume Next")
  FileWriteLine($vbs, 'Set FSO = CreateObject("Scripting.FileSystemObject")')
  FileWriteLine($vbs, 'Set MakeModel = FSO.CreateTextFile("c:\MakeModel.txt", True)')
  FileWriteLine($vbs, 'strComputer = "' & $host & '"')
  FileWriteLine($vbs, 'Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")')
  FileWriteLine($vbs, 'Set colItems2 = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)')
  FileWriteLine($vbs, "")
  FileWriteLine($vbs, "For Each objItem in colItems2")
  FileWriteLine($vbs, "")
  FileWriteLine($vbs, "Make = objItem.Manufacturer")
  FileWriteLine($vbs, "Model = objItem.Model")
  FileWriteLine($vbs, "MakeModel.WriteLine Make")
  FileWriteLine($vbs, "MakeModel.WriteLine Model")
  FileWriteLine($vbs, "")
  FileWriteLine($vbs, "Next")
  FileClose($vbs)
  Run("wscript.exe c:\MakeModel.vbs")
  $txt_MakeModel = FileOpen("c:\MakeModel.txt", 0)
; MakeModel Variables
  $make  = FileReadLine($txt_MakeModel, 1)
  $model = FileReadLine($txt_MakeModel, 2)
  FileClose($txt_MakeModel)
EndFunc

Func Cleanup()
  FileDelete("c:\psinfo.exe")
  FileDelete("c:\pdh.dll")
  FileDelete("c:\psinfo.txt")
;FileDelete("c:\MakeModel.vbs")
  FileDelete("c:\MakeModel.txt")
EndFunc

I'm sure it could use some work, but I'm proud of it.

Ian

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0