How to get the Service Tag from your server using VB scripting

Filed Under (Windows Networking) by Just An Admin on 30-01-2009

When contacting your hardware vendor to report a problem or order additional hardware, like disks or memory, you are often asked to provide the Service Tag. Off course you have the service tags well documented in your CMDB repository. In case your CMDB is not so up to date or lacking any content at all, this little script will grab the tag from any system name or IP you enter, as long as your an admin or allowed to run WMI queries against the system.

Save the code to a file, ie servicetag.vbs, run the script and enter the system name or IP in the pop-up. Entering a . (dot) will query the local machine.



[cc width=”600″ lang=”vb”]

on error resume next
strComputer=InputBox (“Enter the computer name of the server you’d like to query for Service Tag”)
Set objWMIservice = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
set colitems = objWMIservice.ExecQuery(“Select * from Win32_BIOS”,,48)
For each objitem in colitems
Wscript.echo “Service Tag: ” & objitem.serialnumber
Next

[/cc]

Post a comment