Serial Number

  • Thread starter Thread starter scorpion53061
  • Start date Start date
S

scorpion53061

If anybody knows how in the management class we could get a computers serial
number that would be very helpful. I cannot seem to find the method.

Also in the hardware in your machine I can get the pieces but I am having
trouble with identifying numbers like serials or such. Does anyone have
ideas on this?
 
Hi,

Add a reference to system.management.dll.

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_LogicalDisk where Name = 'C:'")

moReturn = moSearch.Get

For Each mo In moReturn

Dim VolumeName As String = mo("Name")

Dim SerialNumber As String = mo("Volumeserialnumber")

Dim strOut As String = String.Format("{0} - {1}", VolumeName, SerialNumber)

Debug.WriteLine(strOut)

Next

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Processor")

moReturn = moSearch.Get

For Each mo In moReturn

Dim strout As String = String.Format("{0} - {1}", mo("Name"),
mo("ProcessorID"))

Debug.WriteLine(strout)

Next



Ken
 
* "scorpion53061 said:
If anybody knows how in the management class we could get a computers serial
number that would be very helpful. I cannot seem to find the method.

There is no "computer serial number". Which number do you exactly want
to deetermine?
 
Hi Scorpion,

The computer has maybe a serial number but it is nowhere as hardware.
(Only written on the back mostly)

The only thing I could think of is the serial number from the motherboard,
but that is also rare.

And therefore I think you cannot get a serial number from your management
system.

I hope this helps?

Cor
 
There is no "computer serial number". Which number do you exactly want
to deetermine?

you know the one on the back of the computer that is usually is printed on a
sticker........
 
I hope this helps?

Well yes it did if it is in fact not possible :(.
Thanks Cor.

Those of us in the MIS business this is for many of us this is the fiscal
"year end" and we are required to do inventory reports. I will have to get
down on my hands and knees and pull the computer out and read it and
manually enter it.
 
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
 
I think I would replace it with

MyRegKey = MyReg.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion")

but please correct me if I am wrong.

Thank you Ken!!

I noticed the NT part.

Is there a way to do this for 98 and Me?

Ken Tucker said:
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
 
Back
Top