jueves, 14 de agosto de 2014

VBS que obtiene los numeros de serie de una lista de computadoras en un archivo TXT



***Inicio del script

On Error Resume Next

Dim System

if Wscript.Arguments.Count >0 then
sSystem=Wscript.Arguments(0)
end if

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("ArchivoDeSalida_SerialNumber.txt", True)
Set objServerlist = objFSO.OpenTextFile("c:\ServerNames.txt", 1)


Do Until objServerList.AtEndOfStream
strComputer = objServerList.ReadLine
'objFile.WriteLine "Server: " & strComputer
'objFile.WriteLine ""


'ComputerName = InputBox("Enter the name of the computer you wish to query")
ComputerName = strComputer
winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &""
Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")

for each SN in SNSet
   'MsgBox "The serial number for the specified computer is: " & SN.SerialNumber
    objFile.WriteLine ComputerName & "," & SN.SerialNumber
Next
Loop

wscript.echo "End"

***Fin del script

No hay comentarios: