ServiceTagDisplay

From HasnoWiki

Jump to: navigation, search

explanation

the code will use WMI and the WScript Network object to pull the service tag information from the computer's BIOS.

code

Dim net 
set net = CreateObject("WScript.Network")
Dim cname
cname = net.ComputerName
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & cname & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
    Wscript.Echo cname & ": " & objSMBIOS.SerialNumber
Next
Personal tools