View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default how to detect host id of a computer using excel

try...

Private Function Get_BIOSserialNum() As String
' Gets the serial number of a PC's BIOS
Dim oWMI As Variant, vSettings As Variant, vBIOS As Variant

Const sComputer$ = _
"winmgmts:{impersonationLevel=impersonate}!\\.\roo t\cimv2"
Set oWMI = CreateObject(sComputer)
Set vSettings = oWMI.ExecQuery("Select * from Win32_BIOS")
For Each vBIOS In vSettings
Get_BIOSserialNum = Trim(vBIOS.SerialNumber): Next
End Function '//Get_BIOSserialNum

...note, though, that some clones won't have a serial number and so
you'll need to handle what to do in this case.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion