Yet another serial number generator. Ported from a vbscript found online.
Just feed a machine name to the script to get an output with a serial number into a csv file.
You can also feed a file with all computer names on separate lines. If executed with no options, the current computer info is returned.
If there is no input, the local machine will be used.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=SerialNumber.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs Yet another serial number generator. Ported from a vbscript found online. Just feed a machine name to the script to get an output with a serial number into a csv file. You can also feed a file with all computer names on separate lines. If executed with no options, the current computer info is returned. If there is no input, the local machine will be used. Alex Belenkiy 09/24/08 #ce #include <array.au3> #include <file.au3> dim $strComputer, $ComputersArray $OutputFile = FileOpen("ServiceTag " & @MON & "-" & @MDAY & "-" & @YEAR & ".csv", 10) FileWriteLine($OutputFile, "Machine Name, Manufacturer, Model Number, Serial Number, Part Number, SMBIOSAssetTag, OtherIdentifyingInfo") If $CmdLine[0] = 0 Then $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\cimv2") $colSMBIOS = $objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure") For $objSMBIOS in $colSMBIOS FileWriteLine($OutputFile, @ComputerName & "," & $objSMBIOS.Manufacturer & "," & $objSMBIOS.Model & "," & $objSMBIOS.SerialNumber & "," & $objSMBIOS.PartNumber & $objSMBIOS.SMBIOSAssetTag & $objSMBIOS.OtherIdentifyingInfo) Next Else if not FileExists($CmdLine[1]) Then $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $CmdLine[1] & "\root\cimv2") if not @error Then $colSMBIOS = $objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure") For $objSMBIOS in $colSMBIOS FileWriteLine($OutputFile, $CmdLine[1] & "," & $objSMBIOS.Manufacturer & "," & $objSMBIOS.Model & "," & $objSMBIOS.SerialNumber & "," & $objSMBIOS.PartNumber & $objSMBIOS.SMBIOSAssetTag & $objSMBIOS.OtherIdentifyingInfo) Next EndIf Else _FileReadToArray($CmdLine[1],$ComputersArray) For $a = 1 to $ComputersArray[0] $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $ComputersArray[$a] & "\root\cimv2") if not @error Then $colSMBIOS = $objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure") For $objSMBIOS in $colSMBIOS FileWriteLine($OutputFile, $ComputersArray[$a] & "," & $objSMBIOS.Manufacturer & "," & $objSMBIOS.Model & "," & $objSMBIOS.SerialNumber & "," & $objSMBIOS.PartNumber & $objSMBIOS.SMBIOSAssetTag & $objSMBIOS.OtherIdentifyingInfo) Next EndIf Next EndIf EndIf FileClose($OutputFile) |
No comments:
Post a Comment