View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Alberto Ast[_2_] Alberto Ast[_2_] is offline
external usenet poster
 
Posts: 181
Default PC Serial number recall

Did work great... not I have serial and computer name.
Great learning today.
Thanks.

"GS" wrote:

<AFAIKEnviron() doesn't return a serial#.
Here's a reusable function that will return the manufacturer's BIOS serial
number of the computer the function is run on.

Function GetPC_SerialNo() As String
' Gets the serial number of a PC's BIOS

Dim sComputer As String, sSerialNo As String
Dim oWMI As Variant
Dim vSettings As Variant, vBIOS As Variant

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

HTH
Kind regards,
Garry