I am trying to run a script to collect data from a number of PCs. The script is as follows:
--------------------------------------------------------
On Error Resume Next
DIM Asset, PCName, Mfr, Model, Serial, User
Set WSHShell = CreateObject("WScript.Shell"
Set objFSO = CreateObject("Scripting.FileSystemObject"
Set objTextFile = objFSO.CreateTextFile("c:\temp\info.txt", True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set colBIOS = objWMIService.ExecQuery ("Select * from Win32_BIOS"
For Each objBIOS in colBIOS
Serial = objBIOS.SerialNumber
Next
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem"
For Each objComputer in colSettings
Asset = Mid(objComputer.Name, 3, 8)
PCName = objComputer.Name
Mfr = objComputer.Manufacturer
Model = objComputer.Model
User = Mid(objComputer.UserName, 11)
Next
objTextFile.WriteLine(Asset & "*" & PCName & "*" & Mfr & "*" & Model & "*" & Serial & "*" & User)
objTextFile.Close
-----------------------------------------------------
I have a text file which is a list of the computernames I wish to run it against.
How could I read the computernames from the text file into an arary and use them in place of the " strComputer = "." " statement?
Thanks,
Noel
--------------------------------------------------------
On Error Resume Next
DIM Asset, PCName, Mfr, Model, Serial, User
Set WSHShell = CreateObject("WScript.Shell"
Set objFSO = CreateObject("Scripting.FileSystemObject"
Set objTextFile = objFSO.CreateTextFile("c:\temp\info.txt", True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set colBIOS = objWMIService.ExecQuery ("Select * from Win32_BIOS"
For Each objBIOS in colBIOS
Serial = objBIOS.SerialNumber
Next
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem"
For Each objComputer in colSettings
Asset = Mid(objComputer.Name, 3, 8)
PCName = objComputer.Name
Mfr = objComputer.Manufacturer
Model = objComputer.Model
User = Mid(objComputer.UserName, 11)
Next
objTextFile.WriteLine(Asset & "*" & PCName & "*" & Mfr & "*" & Model & "*" & Serial & "*" & User)
objTextFile.Close
-----------------------------------------------------
I have a text file which is a list of the computernames I wish to run it against.
How could I read the computernames from the text file into an arary and use them in place of the " strComputer = "." " statement?
Thanks,
Noel