Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a script on multiple machines

Status
Not open for further replies.

nullig

Technical User
Jan 20, 2004
10
CA
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
 
Thanks.

That's exactly what I've been looking for.

Noel
 
I am also in the same boat as Nullig was, but the link that Zmann posted doesn't seem to lead to the appropriate place on the next site. Can you repost the link please? I have been beating my head against the wall for a few days on this particular topic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top