Im trying to write a simple script to get all the service tag numbers from our Dell systems, but for some reason its not working and i must have been looking at it too much cos i cant see what ive missed.
It should connect to the systems stated in the array and then create a CSV file with 2 headings for network name and service tag.
Am i being thick or what here?
arrComputers =
Array("uk01ws03","uk01ws04","uk01ws06","uk01ws07", "uk01ws08","uk01ws09","uk01ws10","uk01ws12","uk01w s14","uk01ws15","uk01ws16"
,"uk01ws17","uk01ws18","uk01ws20","uk01ws21","uk01 ws22","uk01ws23","uk01ws24","uk01ws25","uk01ws26")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_BIOS",,48)
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objNewFile = objFS.CreateTextFile("output.csv")
objNewFile.WriteLine "Network Name,Service Tag"
For Each strComputer In arrComputers
objNewFile.WriteLine Network Name: " & objItem.Name & "," & "Tag Number: " & objItem.SerialNumber
Next
objNewFile.Close
Array("uk01ws03","uk01ws04","uk01ws06","uk01ws07", "uk01ws08","uk01ws09","uk01ws10","uk01ws12","uk01w s14","uk01ws15","uk01ws16"
,"uk01ws17","uk01ws18","uk01ws20","uk01ws21","uk01 ws22","uk01ws23","uk01ws24","uk01ws25","uk01ws26")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_BIOS",,48)
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objNewFile = objFS.CreateTextFile("output.csv")
objNewFile.WriteLine "Network Name,Service Tag"
For Each strComputer In arrComputers
objNewFile.WriteLine Network Name: " & objItem.Name & "," & "Tag Number: " & objItem.SerialNumber
Next
objNewFile.Close
Am i being thick or what here?

Comment