master_windu
asked on
Remotely Obtain Serial Numbers For Multiple PCs At Once?
I located a vbs script some time ago were I get remotely obtain a machines serial number.
On Error Resume Next
Dim System
if Wscript.Arguments.Count >0 then
sSystem=Wscript.Arguments( 0)
end if
ComputerName = InputBox("Enter the name of the computer you wish to query")
winmgmt1 = "winmgmts:{impersonationLe vel=impers onate}!//" & ComputerName &""
Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")
for each SN in SNSet
MsgBox "The serial number for the specified computer is: " & SN.SerialNumber
Next
pause
Works fine on most pcs. What I would like to do however is instead of checking 1 by one, I would like to check multiple pcs at once. Does anyone know how I can do this?
Thanks
On Error Resume Next
Dim System
if Wscript.Arguments.Count >0 then
sSystem=Wscript.Arguments(
end if
ComputerName = InputBox("Enter the name of the computer you wish to query")
winmgmt1 = "winmgmts:{impersonationLe
Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")
for each SN in SNSet
MsgBox "The serial number for the specified computer is: " & SN.SerialNumber
Next
pause
Works fine on most pcs. What I would like to do however is instead of checking 1 by one, I would like to check multiple pcs at once. Does anyone know how I can do this?
Thanks
That works down a list in complist.txt, one per line of all your computers.
ASKER
thanks
I must be doing something wrong
I created the complist.txt file and placed it in the same dir as the .cmd and vbs file
when I run serialnums.cmd, the cmd window appears with todays date and the word "dest"
the serials.txt file is generated but it only reads.....
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
I must be doing something wrong
I created the complist.txt file and placed it in the same dir as the .cmd and vbs file
when I run serialnums.cmd, the cmd window appears with todays date and the word "dest"
the serials.txt file is generated but it only reads.....
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. works great as long as i use ip addesses in the complist.txt file.
any way i can use machine names?
any way i can use machine names?
Can your computer resolve the names when you PING them for starters I suppose? You might have to add them to the file fully qualified, i.e. name.domain.com?
ASKER
all is well. I went back and tried some more machine names and I was able to get back a serial without the fqdm.
Thanks
Thanks
No problem, glad to help!
Steve
Steve
@echo off
REM Save as SerialNums.cmd
set source=complist.txt
set dest=serials.txt
echo ------------%DATE% %TIME-------------->>%dest
if not exist "%source%" then echo Unable to find computer list & goto end
for /f "tokens=1" %%a in (complist.txt) do cscript sernum.vbs %%a >> serials.txt
:end
REM sernum.vbs
On Error Resume Next
Dim ComputerName
if Wscript.Arguments.Count >0 then
ComputerName=Wscript.Argum
else
ComputerName = InputBox("Enter the name of the computer you wish to query")
end if
winmgmt1 = "winmgmts:{impersonationLe
Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")
for each SN in SNSet
wscript.echo ComputerName,SN.SerialNumb
Next