Monday, February 19, 2007

Remotely Retrieve Service Tags from Dell PC's

Taken from LazyNetworkAdmin

Because most of the computers I work on are Dell's, a lot of times I need to look up the service tag for a specific machine. Without the need of bulky software, you can easily use WMI to gather this information. This article will show you how to remotely query your dell pc's for their service tags.

Open notepad and copy the following text and paste it into your blank notepad

----------COPY EVERYTHING BELOW THIS LINE----------
'
on error resume next
strIPAddress=InputBox ("Enter the IP Address of the PC you'd like to query for Service Tag")
Set objWMIservice = GetObject("winmgmts:\\" & strIPAddress & "\root\cimv2")
set colitems = objWMIservice.ExecQuery("Select * from Win32_BIOS",,48)
For each objitem in colitems
Wscript.echo "Dell Service Tag: " & objitem.serialnumber
Next
'
----------COPY EVERYTHING ABOVE THIS LINE----------

PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR NOTEPAD!!!

save the file as DellServiceTag.vbs to a location you will remember

when you execute the script, it will prompt you for a computer name, type in the computer name of the dell machine you are trying to gather information from into the message box and hit OK

You will then receive another message box with the dell service tag.

If you want to run this against multiple machines then do the following:

Open notepad and copy the following text and paste it into your blank notepad

----------COPY EVERYTHING BELOW THIS LINE----------
'
on error resume next
Wscript.echo strComputer & ": " & objitem.serialnumber
Set objWMIservice = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colitems = objWMIservice.ExecQuery("Select * from Win32_BIOS",,48)
For each objitem in colitems
Wscript.echo "Dell Service Tag: " & objitem.serialnumber
Next
'
----------COPY EVERYTHING ABOVE THIS LINE----------

PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR NOTEPAD!!!

Save the file as bath_DellServiceTag.vbs

Now open a new Notepad and follow this format:

C:\path\to\my\scripts\> cscript servicetag.vbs pc1 >> service_tag.txt
C:\path\to\my\scripts\> cscript servicetag.vbs pc2 >> service_tag.txt
C:\path\to\my\scripts\> cscript servicetag.vbs pc3 >> service_tag.txt
C:\path\to\my\scripts\> cscript servicetag.vbs pc4 >> service_tag.txt

Replace pc1, pc2, pc3 with your actual computer names.

save the file as dell_service_tag.bat.

Double click on the dell_service_tag.bat file and you will be left with service_tag.txt with all of your PC's Dell Service tags inside

This information was found on http://www.rokus.net/.

This information is provided "AS IS" with no warranties expressed or implied.

At work when we raise calls to our 2nd Line team we require to provide the Asset Number and Model of the PC which can be a pain to get after you are off the line with a user. Our Asset tag (and workstation name) is either a combination of undefined numbers or service tags so the above should work to retrieve the service tag from a remote PC from the workstation name which can be used with this to get the Model of the PC.

Sweet!

Jon.