|
-
Dec 14th, 2003, 09:32 PM
#1
Thread Starter
Fanatic Member
Hardware serial number
How to get Hardware s/n thru VB.NET? ..please advise?
Thanks a lot
Regards
Winanjaya
-
Dec 15th, 2003, 05:52 AM
#2
Frenzied Member
What hardware? any hardware? I know for hard disk you can use this method:
VB Code:
Dim mgmclass As New System.Management.ManagementClass("Win32_PhysicalMedia")
Dim mgmcoll As Management.ManagementObjectCollection = mgmclass.GetInstances()
Dim mgmenum As Management.ManagementObjectCollection.ManagementObjectEnumerator = mgmcoll.GetEnumerator
mgmenum.MoveNext()
MessageBox.Show(mgmenum.Current.Properties("SerialNumber").Value.ToString)
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Dec 15th, 2003, 06:08 AM
#3
Thread Starter
Fanatic Member
Thanks, I need any hardware ID .. likes motherboard, processor, vga card .. and may be hard disk s/n .. what serial no. of harddisk you provided ? .. is that hardware s/n or just o/s s/n? .. what I need is hardware s/n .. I cannot use o/s s/n because it will be changed if it formatted .. any comment?
thanks a lot in advance
Regards
Winanjaya
-
Dec 15th, 2003, 06:10 AM
#4
Frenzied Member
What I provided is the hardcoded hard disk serial number, the one you can see on the sticker on the hard disk. You may play with that class to get the serial number of ther devices but I am afraid there will be no other .NET way of doing that.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Dec 15th, 2003, 06:12 AM
#5
Thread Starter
Fanatic Member
So I though this should be unique s/n.. (correct me If I'm wrong) .. does it compatible for all of harddisk types and brands? please advise?
thanks
Winanjaya
-
Dec 15th, 2003, 06:15 AM
#6
Frenzied Member
It is unique and it should be compatible, but honestly I am not sure.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Dec 15th, 2003, 06:18 AM
#7
Frenzied Member
By the way I am not sure that method i provided run on all Windows. I am sure it runs on XP and 2003.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Dec 15th, 2003, 06:25 AM
#8
Thread Starter
Fanatic Member
I tried it already, it gave me the following error:
An unhandled exception type
'System.Management.ManagementException' occured in system.management.dll
Additional information: Not found.
pls help,
Thanks
Winanjaya
-
Dec 15th, 2003, 06:26 AM
#9
Frenzied Member
What windows are you running?
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Dec 15th, 2003, 06:28 AM
#10
Thread Starter
Fanatic Member
and my o/s is Win 2000 AS.. am I missing something? thanks
Winanjaya
-
Dec 15th, 2003, 06:33 AM
#11
Frenzied Member
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Dec 15th, 2003, 06:41 AM
#12
Frenzied Member
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Dec 15th, 2003, 07:09 AM
#13
Thread Starter
Fanatic Member
but I don't understand C# ..
-
Dec 15th, 2003, 07:25 AM
#14
Sleep mode
Originally posted by Winanjaya
but I don't understand C# ..
Use this converter http://www.kamalpatel.net/ConvertCSharp2VB.aspx . If you stuck in any part let's know we might help .
or
Compile the classes (if any because I didn't check) into dll library and use them in your vb project.
-
Dec 15th, 2003, 07:56 AM
#15
Thread Starter
Fanatic Member
the error I explained was come from below code:
Dim mgmcoll As Management.ManagementObjectCollection = mgmclass.GetInstances()
Regards
Winanjaya
-
Dec 15th, 2003, 09:05 AM
#16
Sleep mode
I've just tested the code Lunatic3 has posted and it works . As he said , this method requires XP or later versions of Windows . Your best bet now is to look for API path so it can run on any OS .
Last edited by Pirate; Dec 15th, 2003 at 09:12 AM.
-
Dec 15th, 2003, 09:50 AM
#17
Thread Starter
Fanatic Member
Thanks for your suggestion, could you please give me the information about where can I find the article or example for this ?
TIA
Winanjaya
-
Dec 15th, 2003, 10:23 AM
#18
Sleep mode
Try this example , at least it gives positive result not like some other methods (either negative number or some crap ) . There are multiple ways other than API and WMI (Scripting , FSO , some OCXs) .
All search result can be found here :
They are all VB6 proj but using API calls .
Last edited by Pirate; Dec 15th, 2003 at 10:27 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|