PC Serial number recall

A

Alberto Ast

Is there a way to pull the PC serial number or PC user name preferable serial
number.... using vb so I can record it in a file indicating from which
computer the update was made?
 
G

GS

<AFAIK>Environ() 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}!\\.\root\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
 
A

Alberto Ast

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

fisch4bill

Environ("COMPUTERNAME") and Environ("USERNAME") should give you pretty
definitive information. (Not only the computer, but also the user.)
I didn't find a PC Serial Number in the Environment Variables
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top