By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 1,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

Serial Number

P: n/a
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?
Nov 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
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" <Its the end of the world as we know it@here.com> wrote in
message news:u7**************@TK2MSFTNGP11.phx.gbl...
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?

Nov 20 '05 #2

P: n/a
* "scorpion53061" <Its the end of the world as we know it@here.com> scripsit:
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?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

P: n/a
Cor
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

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?

Nov 20 '05 #4

P: n/a
> 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........
Nov 20 '05 #5

P: n/a
> 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.
Nov 20 '05 #6

P: n/a
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

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

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eO****************@TK2MSFTNGP12.phx.gbl...
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" <Its the end of the world as we know it@here.com> wrote in
message news:u7**************@TK2MSFTNGP11.phx.gbl...
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?


Nov 20 '05 #7

P: n/a
Thank you Ken!!

I noticed the NT part.

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

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
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

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

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eO****************@TK2MSFTNGP12.phx.gbl...
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" <Its the end of the world as we know it@here.com> wrote in message news:u7**************@TK2MSFTNGP11.phx.gbl...
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?



Nov 20 '05 #8

P: n/a
I think I would replace it with

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

but please correct me if I am wrong.

"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
Thank you Ken!!

I noticed the NT part.

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

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
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

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

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eO****************@TK2MSFTNGP12.phx.gbl...
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" <Its the end of the world as we know it@here.com> wrote in
message news:u7**************@TK2MSFTNGP11.phx.gbl...
> 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?
>
>



Nov 20 '05 #9

P: n/a
Hi,

Think that is correct.
http://www.annoyances.org/exec/forum/win98/n1059073522
Ken
-----------------
"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:ui****************@TK2MSFTNGP12.phx.gbl...
I think I would replace it with

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

but please correct me if I am wrong.

"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
Thank you Ken!!

I noticed the NT part.

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

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
> 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
>
> -------------------
>
> "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
> news:eO****************@TK2MSFTNGP12.phx.gbl...
> > 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" <Its the end of the world as we know it@here.com> wrote
in
> > message news:u7**************@TK2MSFTNGP11.phx.gbl...
> >> 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?
> >>
> >>
> >
> >
>
>



Nov 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.