' Dell-ServiceTag ' ' Purpose: Obtain the Dell service tag from a Dell computer or computers. ' ' Version: 1.0 ' Created on: 2008-01-10 ' Last updated: 2008-01-10 ' ' Created By: Jim Cameron ' ' Download URL: ' http://support.moonpoint.com/downloads/computer_languages/VBScript/Dell-ServiceTag.vbs ' ' Note: Based on a script written by LazyNetworkAdmin ' (http://lazynetworkadmin.com/), which is provided at ' http://lazynetworkadmin.com/content/view/13/6/ ' ' Usage: From a command prompt, use "cscript /nologo dell-servicetag.vbs ' ' ' Examples: ' ' 1. Query computer on which the script is run: ' ' cscript /nologo dell-servicetag.vbs . ' ' 2. Query multiple computers named a, b, c ' ' cscript /nologo dell-servicetag.vbs a b c ' ' Output: ' ' Computer: a Dell Service Tag: ZRKF461 ' Computer: b Dell Service Tag: ZZ89M81 ' Computer: c Dell Service Tag: EYCNH41 ' ' -------------------------------------------------------------------------- ' strVersion = "1.0" ' If the system doesn't exist or is inaccessible don't display a window ' with error code in it. On error resume next If Wscript.Arguments.Count = 0 Then ShowUsage() Else Dim arrComputers() For i = 0 to Wscript.Arguments.Count - 1 Redim Preserve arrComputers(i) arrComputers(i) = Wscript.Arguments(i) Next End If For Each strComputer in arrComputers Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colComputer = objWMIservice.ExecQuery("Select * from Win32_BIOS",,48) For Each objComputer in colComputer If Err.Number=0 Then Wscript.Echo "Computer: " & strComputer & " " & _ "Dell Service Tag: " & objComputer.serialnumber Else WScript.Echo strComputer & " " Err.Clear End If Next Next Wscript.Quit sub ShowUsage() WScript.Echo "Dell-ServiceTag " & strVersion & vbcrlf & _ vbcrlf & _ "Display the service tag for a Dell computer or computers." & vbcrlf & _ vbcrlf & _ "Usage: From a command prompt, use cscript /nologo " & _ "dell-servicetag.vbs computername1" & vbcrl & _ " computername2" & vbcrlf & _ vbcrlf & _ "Examples:" & vbcrlf & _ vbcrlf & _ " 1. Query computer on which the script is run (a period can be " & vbcrlf _ & " used in lieu of the name of the current computer):" & vbcrlf & _ vbcrlf & _ " cscript /nologo dell-servicetag.vbs ." & vbcrlf & _ vbcrlf & _ " 2. Query multiple computers named a, b, c:" & vbcrlf & _ vbcrlf & _ " cscript /nologo dell-servicetag.vbs a b c" WScript.Quit End Sub