469,336 Members | 5,570 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Retrieving a system serial number...

Does anyone know how to retrieve the system serial number? I'm writing an
auditing program and need to grab that little bit of info.

Thanks!
Nov 21 '05 #1
10 14550
Maybe you can use the serialnumber from the next api-call:
Private Declare Function GetVolumeInformation Lib "Kernel32" Alias
"GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal
lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long,
lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long,
lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal
nFileSystemNameSize As Long) As Long

"Terry Olsen" <to******@hotmail.com> wrote in message
news:Oa**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how to retrieve the system serial number? I'm writing an
auditing program and need to grab that little bit of info.

Thanks!

Nov 21 '05 #2
Terry,

There is not a real serial number, there is sometimes a processor number and
with a computer connected to a LAN or whatever that uses a network adapter,
a Mac address, and probably more numbers, however as far as I have seen not
an always existing unique one.

You can find those starting reading here reading (after that a is a little
sample in this message).

http://msdn.microsoft.com/library/de...Management.asp

http://msdn.microsoft.com/library/de...classtopic.asp

It are a lot of collections in collections.

I have not at the moment a sample at hand for those numbers, however see
this sample how to get drive information. I do not know where I got it
anymore.

\\\Add a reference to "System.Management.dll".
Dim disk As New ManagementObject( _
"Win32_LogicalDisk.DeviceID=""C:""" )
Dim diskProperty As PropertyData
For Each diskProperty In disk.Properties
Console.WriteLine( _
"{0} = {1}", _
diskProperty.Name,
diskProperty.Value )
Next diskProperty
///

I hope this helps?

Cor


"Terry Olsen" <to******@hotmail.com> schreef in bericht
news:Oa**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how to retrieve the system serial number? I'm writing an
auditing program and need to grab that little bit of info.

Thanks!

Nov 21 '05 #3
Maybe you can use the serialnumber from the next api-call:
Private Declare Function GetVolumeInformation Lib "Kernel32" Alias
"GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal
lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long,
lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long,
lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal
nFileSystemNameSize As Long) As Long

"Terry Olsen" <to******@hotmail.com> wrote in message
news:Oa**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how to retrieve the system serial number? I'm writing an
auditing program and need to grab that little bit of info.

Thanks!

Nov 21 '05 #4
Hi,

Windows serial number

Dim myReg As RegistryKey = Registry.LocalMachine

Dim MyRegKey As RegistryKey

Dim MyVal As String

MyRegKey = myReg.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion")

MyVal = MyRegKey.GetValue("ProductID")

MyRegKey.Close()

Ken

---------------------------------

"Terry Olsen" <to******@hotmail.com> wrote in message
news:Oa**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how to retrieve the system serial number? I'm writing an
auditing program and need to grab that little bit of info.

Thanks!

Nov 21 '05 #5
Hi,

Windows serial number

Dim myReg As RegistryKey = Registry.LocalMachine

Dim MyRegKey As RegistryKey

Dim MyVal As String

MyRegKey = myReg.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion")

MyVal = MyRegKey.GetValue("ProductID")

MyRegKey.Close()

Ken

---------------------------------

"Terry Olsen" <to******@hotmail.com> wrote in message
news:Oa**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how to retrieve the system serial number? I'm writing an
auditing program and need to grab that little bit of info.

Thanks!

Nov 21 '05 #6
We use HP/Compaq & IBM machines. Belarc Advisor is able to show the system
serial number of these machines (matches the serial number the vendor puts
on the nameplate). That's what I'm wanting to figure out how to grab...
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Terry,

There is not a real serial number, there is sometimes a processor number
and with a computer connected to a LAN or whatever that uses a network
adapter, a Mac address, and probably more numbers, however as far as I
have seen not an always existing unique one.

You can find those starting reading here reading (after that a is a
little sample in this message).

http://msdn.microsoft.com/library/de...Management.asp

http://msdn.microsoft.com/library/de...classtopic.asp

It are a lot of collections in collections.

I have not at the moment a sample at hand for those numbers, however see
this sample how to get drive information. I do not know where I got it
anymore.

\\\Add a reference to "System.Management.dll".
Dim disk As New ManagementObject( _
"Win32_LogicalDisk.DeviceID=""C:""" )
Dim diskProperty As PropertyData
For Each diskProperty In disk.Properties
Console.WriteLine( _
"{0} = {1}", _
diskProperty.Name,
diskProperty.Value )
Next diskProperty
///

I hope this helps?

Cor


"Terry Olsen" <to******@hotmail.com> schreef in bericht
news:Oa**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how to retrieve the system serial number? I'm writing
an auditing program and need to grab that little bit of info.

Thanks!


Nov 21 '05 #7
We use HP/Compaq & IBM machines. Belarc Advisor is able to show the system
serial number of these machines (matches the serial number the vendor puts
on the nameplate). That's what I'm wanting to figure out how to grab...
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Terry,

There is not a real serial number, there is sometimes a processor number
and with a computer connected to a LAN or whatever that uses a network
adapter, a Mac address, and probably more numbers, however as far as I
have seen not an always existing unique one.

You can find those starting reading here reading (after that a is a
little sample in this message).

http://msdn.microsoft.com/library/de...Management.asp

http://msdn.microsoft.com/library/de...classtopic.asp

It are a lot of collections in collections.

I have not at the moment a sample at hand for those numbers, however see
this sample how to get drive information. I do not know where I got it
anymore.

\\\Add a reference to "System.Management.dll".
Dim disk As New ManagementObject( _
"Win32_LogicalDisk.DeviceID=""C:""" )
Dim diskProperty As PropertyData
For Each diskProperty In disk.Properties
Console.WriteLine( _
"{0} = {1}", _
diskProperty.Name,
diskProperty.Value )
Next diskProperty
///

I hope this helps?

Cor


"Terry Olsen" <to******@hotmail.com> schreef in bericht
news:Oa**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how to retrieve the system serial number? I'm writing
an auditing program and need to grab that little bit of info.

Thanks!


Nov 21 '05 #8
Terry,

I almost forgot to answer you, using the links I showed you and the code
you can use boards, baseboard, serialnumber, than you get the serialnumer of
the baseboard, I do not know if that is the number what is as well what is
at the back of your computers. However the information you can get is so
immense, it is impossible to tell you what it is what without trying.

I hope this helps?

Cor

"Terry Olsen" <to******@hotmail.com> ..
We use HP/Compaq & IBM machines. Belarc Advisor is able to show the
system serial number of these machines (matches the serial number the
vendor puts on the nameplate). That's what I'm wanting to figure out how
to grab...
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Terry,

There is not a real serial number, there is sometimes a processor number
and with a computer connected to a LAN or whatever that uses a network
adapter, a Mac address, and probably more numbers, however as far as I
have seen not an always existing unique one.

You can find those starting reading here reading (after that a is a
little sample in this message).

http://msdn.microsoft.com/library/de...Management.asp

http://msdn.microsoft.com/library/de...classtopic.asp

It are a lot of collections in collections.

I have not at the moment a sample at hand for those numbers, however see
this sample how to get drive information. I do not know where I got it
anymore.

\\\Add a reference to "System.Management.dll".
Dim disk As New ManagementObject( _
"Win32_LogicalDisk.DeviceID=""C:""" )
Dim diskProperty As PropertyData
For Each diskProperty In disk.Properties
Console.WriteLine( _
"{0} = {1}", _
diskProperty.Name,
diskProperty.Value )
Next diskProperty
///

I hope this helps?

Cor


"Terry Olsen" <to******@hotmail.com> schreef in bericht
news:Oa**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how to retrieve the system serial number? I'm writing
an auditing program and need to grab that little bit of info.

Thanks!



Nov 21 '05 #9
I think I found what I need to get the serial number. It's in the
Win32_BaseBoard WMI Class. Now I need help on how to use it. I tried
this:

Dim w32bb As New ManagementObject("Win32_BaseBoard")

But that give me an exception "specified argument was out of the range
of valid values"

Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #10
I found the following code at
http://www.freevbcode.com/ShowCode.asp?ID=2664. Modified it
ever-so-slightly to work in VB.NET. But it retrieves the SerialNumber.

Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinMgmts:")
objs = WMI.InstancesOf("Win32_BaseBoard")
For Each obj In objs
MsgBox(obj.SerialNumber.ToString)
Next
Nov 21 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.