-
How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
I want to give my app for trial version.. therefore for this purpose
How can i know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc.
Plz Help.....:wave:
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
You can't because there is no standard way that hardware companies provide this information. What you would need to do is work out a hardware detection algorithm similar to what Windows XP does.
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by bgmacaw
You can't because there is no standard way that hardware companies provide this information. What you would need to do is work out a hardware detection algorithm similar to what Windows XP does.
hmm...
then you know what is standard way to distribute application for trial versions..
if i give disk serial no or other id for this purpose then it will be change when going to system formating..
...and also i think every thing which store in storage disk or boot sector; it can be change by experts.. No??:confused:
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Actually you can (some dont provide the serial numbers, havent come across any that have not yet though), I have the code here for the hard drive firmware serial number (not the volume serial number), works in Limited user mode in XP and in Vista, but it is very detailed and there is more to creating a trial version and or activation then just getting the hardware ID. Also, you cannot depend on just the hard drive serial number, also to the other member, yes MS will use the Hard Drive serial number (if available) along with other hardware.
Here is an older method though, but you dont get the number if the user is logged on as a Limited User:
http://www.vbforums.com/showpost.php...3&postcount=23
Unless you are willing to spend a couple months putting something together, you may want to take a look at a Trial Creator program or something else, see this thread. http://www.vbforums.com/showpost.php?p=3025904
Anyway here is the Motherboard Serial and Bios ID using WMI, I wont post the hard drive code though as well it is too much, I didnt write it, and I really dont want to take it out of my project right now (maybe another time). Like I said though getting the serial numbers etc is the easy part, there is alot more involved with activations etc. Check out the software link in the thread I posted above, it tested it last night and it works, and its free.
Code:
Public Function GetBiosVersion() As String
Dim strComputerName As String
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
On Local Error Resume Next
strComputerName = Space(255)
GetComputerName strComputerName, 255
strComputerName = Left(strComputerName, InStr(1, strComputerName, Chr(0)) - 1)
Set objWMIService = GetObject("winmgmts:\\" & strComputerName)
Set colItems = objWMIService.ExecQuery("Select SerialNumber from Win32_BIOS", , 48)
For Each objItem In colItems
GetBiosVersion = objItem.SerialNumber
Next
Set colItems = Nothing
Set objWMIService = Nothing
End Function
Public Function GetMoboNumber() As String
Dim strComputerName As String
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
On Local Error Resume Next
strComputerName = Space(255)
GetComputerName strComputerName, 255
strComputerName = Left(strComputerName, InStr(1, strComputerName, Chr(0)) - 1)
Set objWMIService = GetObject("winmgmts:\\" & strComputerName)
Set colItems = objWMIService.ExecQuery("SELECT SerialNumber FROM Win32_BaseBoard", , 48)
For Each objItem In colItems
GetMoboNumber = objItem.SerialNumber
Next objItem
Set colItems = Nothing
Set objWMIService = Nothing
End Function
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by rory
Actually you can (some dont provide the serial numbers, havent come across any that have not yet though), I have the code here for the hard drive firmware serial number (not the volume serial number), works in Limited user mode in XP and in Vista, but it is very detailed and there is more to creating a trial version and or activation then just getting the hardware ID. Also, you cannot depend on just the hard drive serial number, also to the other member, yes MS will use the Hard Drive serial number (if available) along with other hardware.
Here is an older method though, but you dont get the number if the user is logged on as a Limited User:
http://www.vbforums.com/showpost.php...3&postcount=23
Unless you are willing to spend a couple months putting something together, you may want to take a look at a Trial Creator program or something else, see this thread.
http://www.vbforums.com/showpost.php?p=3025904
Anyway here is the Motherboard Serial and Bios ID using WMI, I wont post the hard drive code though as well it is too much, I didnt write it, and I really dont want to take it out of my project right now (maybe another time). Like I said though getting the serial numbers etc is the easy part, there is alot more involved with activations etc. Check out the software link in the thread I posted above, it tested it last night and it works, and its free.
i run your code... it execute properly but can not fetches any id...??
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by rory
How did you run it?
i copy and paste your code in new vb form and also paste code of ..
"Private Declare Function GetComputerName Lib "KERNEL32" _
Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long"
and then i give this..
Private Sub Form_click()
MsgBox Me.GetMoboNumber
MsgBox Me.GetBiosVersion
End Sub
(FOR REMMEMBER I USE WINDOW XP)
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by nilesh16782
i copy and paste your code in new vb form and also paste code of ..
"Private Declare Function GetComputerName Lib "KERNEL32" _
Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long"
and then i give this..
Private Sub Form_click()
MsgBox Me.GetMoboNumber
MsgBox Me.GetBiosVersion
End Sub
(FOR REMMEMBER I USE WINDOW XP)
Remove the GetComputerName API Declaration, you dont need it in this case.
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
i m trid Your GetHDDSerialNumber.zip it works well...(thanks)
In this i want to know..
Is HDD Serial Number changable or not??
and it is relaible to create programs of trial versions..??
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Its an old version, it will work but it will not get a serial number if the user of the program is logged in as a Limited user, they have to be logged in as Admin. There is other code out there though that does get the serial number when in either Limited or Admin mode, I just cant post it right now.
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by rory
Its an old version, it will work but it will not get a serial number if the user of the program is logged in as a Limited user, they have to be logged in as Admin. There is other code out there though that does get the serial number when in either Limited or Admin mode, I just cant post it right now.
Then i think it not sutable to use this code for create a trial version program to distribute world wide( where i not know user which system and O/S use.. )
ok please can you tell me....
Is HDD Serial Number changable or not??
and it is relaible(your program to know HDD Serial No. and generate key...) to create programs of trial versions..??
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by nilesh16782
Then i think it not sutable to use this code for create a trial version program to distribute world wide( where i not know user which system and O/S use.. )
Free software that will do it for you. I tried to see how they do it but I gave up after an hour or so. So it works pretty good.
http://www.softwarekey.com/swk_products/trial_creator/
Open source project:
http://activelocksoftware.com/
I use activation in one of my programs also, i use the HDD one you tried, but changing it to another method when I get some free time, though I also use the Bios ID and the Motherboard serial, as well as the user name. It can use all of them, but it has to have at least the HDD serial, or, the Bios ID and the Motherboard Serial, without either of those 2 groups it will not activate. It also uses the User's name, which must be entered in a text box. Using all that, it is all encrypted and encoded then a Serial Key is created out of that. The activation code is based on the same idea. They send me the Serial Key and I send them back an Activation Code. The program then does its thing and checks if it is valid.
Its pretty straight forward, keeps everything else encrypted using Rijndael in a data file. Ofcourse like anything it is crackable. You need to also put jumps all over the place, dont name things how you normally would (least with the activation part of it), write down your design so you will be able to go back to it and understand it, as you want to make it as hard to understand as possible. In other words just dont say "If this = that then Activated" as that will be hacked in no time.
Im no expert in this though, Ive also used KeyLok for another app I did, and honestly when I start to get more sales i will fork out the money to buy a solution for this program, one that is ready made, as my time is better spent working on what I do best, and letting the companies that do this type of thing 24/7 deal with that part of it. Its just something to make it more difficult to hack for now :)
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by nilesh16782
ok please can you tell me....
Is HDD Serial Number changable or not??
and it is relaible(your program to know HDD Serial No. and generate key...) to create programs of trial versions..??
See post above.
That is the hard drive's firmware number, far as I know you cant change that.
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
ok..
LOT of THANKS for your LOOOOOOOOOOOOOOOT of help.....:)
:wave:
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Ok see attached to get the HDD serial number using the old and the new method. I also added in the Bios and Motherboard numbers (uses WMI) as well as the Bios Version. This will get everything whether or not the user is in Admin or Limited user modes.
There are other things you can get like MAC address, IP, DNS, etc, but those can be changed, or they do change; so I don't use them.
Ideally you would put this all in a single class module, but for now I left it as 3 separate modules (plus the declarations module).
Good luck! :)
Ps. Original Developers Copyrights and Disclaimers, and other sources, are included where they are required.
Note. WMI can take a few milliseconds to initiate the first time it has been run since Windows Startup; WMI is only used for the motherboard info. Also, not 100% certain whether either HDD method works with SMART disabled, perhaps someone can confirm that, my current bios does not allow disabling it.
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
I use the PC's NIC for trial coding.
Check the link below...Get MAC
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Yeah but you can change the mac.
Also, using that code in your sig, my mac is: 00-00-00-00-00-00
I also originally had the mac as an option in my activation but had to take it out.
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
OK What you think about this code....
This code return HDD SNO. ..
IS IT RELIABLE???
Code:
Private Sub Form_Load()
Dim fs, d, s, t
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName("C:\")))
Select Case d.DriveType
Case 0: t = "Unknown"
Case 1: t = "Removable"
Case 2: t = "Fixed"
Case 3: t = "Network"
Case 4: t = "CD-ROM"
Case 5: t = "RAM Disk"
End Select
s = "Drive " & d.DriveLetter & ": - " & t
s = s & vbCrLf & "SN: " & d.SerialNumber
MsgBox s
End Sub
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
No, that is not the firmware serial number.
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
rory, if the whole reason is to make sure only steals or moves your trial version, then check several PC values, NIC, HDD, amount of memory, speed, a value stored on the disk, in the reg...etc
If any one of these change, ..........
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Yes, please see my attached file above, which does just that, and my other posts on how I handle the actual activation.
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
hello i just used rory's code for bios and mobo number and the bios one works ok but when i run the mobo one:
Private Sub Command1_Click()
Text1.Text = GetMoboNumber()
End Sub
it waits for a while then says "none" in the textbox
:confused:
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by killo
hello i just used rory's code for bios and mobo number and the bios one works ok but when i run the mobo one:
Private Sub Command1_Click()
Text1.Text = GetMoboNumber()
End Sub
it waits for a while then says "none" in the textbox
:confused:
Not all mobo's will return a serial number. What mobo do you have; brand and model number? Also what OS are you using?
Also, add Exit For in the For Next loop to see if that ends it quicker, and please let us know, thanks.
Code:
'get bios id, bios serial, and mobo serial with WMI
Public Function GetMotherboard() As Boolean
On Error GoTo Error_Handler
Dim strComputerName As String
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
strComputerName = Space$(255)
GetComputerName strComputerName, 255
strComputerName = Left$(strComputerName, InStr(1, strComputerName, Chr(0)) - 1)
Set objWMIService = GetObject("winmgmts:\\" & strComputerName)
Set colItems = objWMIService.ExecQuery("Select Version, SerialNumber from Win32_BIOS", , 48)
For Each objItem In colItems
BiosVersion = UCase(Replace(objItem.Version, " ", ""))
BiosSerial = objItem.SerialNumber
Exit For
Next objItem
Set colItems = objWMIService.ExecQuery("Select SerialNumber from Win32_BaseBoard", , 48)
For Each objItem In colItems
MoboSerial = objItem.SerialNumber
Exit For
Next objItem
GetMotherboard = True
Error_Handler:
Set colItems = Nothing
Set objWMIService = Nothing
End Function
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
ok i tried that but it still doesn't work. it does end it quicker but still says "none" in the textbox heres the code i'm using:
Code:
'get bios id, bios serial, and mobo serial with WMI
Option Explicit
Private Declare Function GetComputerName Lib "KERNEL32" _
Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Dim strComputerName As String
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
Dim biosversion As String
Dim biosserial As String
Dim moboserial As String
Public Function GetMotherboard() As Boolean
On Error GoTo Error_Handler
strComputerName = Space$(255)
GetComputerName strComputerName, 255
strComputerName = Left$(strComputerName, InStr(1, strComputerName, Chr(0)) - 1)
Set objWMIService = GetObject("winmgmts:\\" & strComputerName)
Set colItems = objWMIService.ExecQuery("Select Version, SerialNumber from Win32_BIOS", , 48)
For Each objItem In colItems
biosversion = UCase(Replace(objItem.Version, " ", ""))
biosserial = objItem.SerialNumber
Exit For
Next objItem
Set colItems = objWMIService.ExecQuery("Select SerialNumber from Win32_BaseBoard", , 48)
For Each objItem In colItems
moboserial = objItem.SerialNumber
Exit For
Next objItem
GetMotherboard = True
Error_Handler:
Set colItems = Nothing
Set objWMIService = Nothing
End Function
Private Sub Command1_Click()
Call GetMotherboard
Text1.Text = moboserial
End Sub
Private Sub Command2_Click()
Call GetMotherboard
Text2.Text = biosserial & vbCrLf & biosversion
End Sub
however the bios serial and bios version works fine,
also, if the user upgraded their bios firmware, then would the bios serial or bios version change?
I'm unning windows xp, i am not on a limited account and i dont know my motherboard manufacturer
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
can anyone help me with this as i would like to use it in a program registration scheme, maybe the user clicks register and my program gives them their motherboard or bios serial no. and then I SHA1 hash it and encrypt it a few times and send it back then my program veirifies it
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by
rory
Remove the GetComputerName API Declaration, you dont need it in this case.
Hi Rory
Although I am too late to this post I feel it is very useful for me.
However If I remove the GetComputName API Declatartion i get a compile error saying Sub or function not defined highligting (GetComputerName strComputerName, 255)
If use that API declaration I see GetBiosVersion works fine and GetMoboNumber as blank
Nasreen
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by
nasreen
However If I remove the GetComputName API Declatartion i get a compile error saying Sub or function not defined highligting (GetComputerName strComputerName, 255)
For the local PC I believe you can just use "." for the ComputerName,
strComputerName = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputerName)
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Id say avoid using WMI, because if im not wrong, its only included in WinXp & above...
unless thats the targes OS you're aiming...
Use API's to get infos about the pc and the regedit has plenty of info for you to use...
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Hi some1uk03
Quote:
Originally Posted by
some1uk03
Id say avoid using WMI, because if im not wrong, its only included in WinXp & above...
unless thats the targes OS you're aiming...
Use API's to get infos about the pc and the regedit has plenty of info for you to use...
Can you please give more idea with example how to capture PC infos using API
Nasreen
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
The code provided with old and new method does not work on Vista and Windows 7 :(
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
@roy, please share your code to get MFG's HDD Serial in both Administrator and Limited user mode (without using WMI Services cause I actually don't want to add one more scripting library in my apps, just plain api code only)
Thanks!
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
limited user can't get hdd serial number using api
if you don't want to use wmi, no solution for limited user
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
According to Randy Birch: The drive code will only work for SMART drives; not older plain IDE drives
Original code here: http://vbnet.mvps.org/code/disk/smartide.htm
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by
hai2hai
It will still work for IDE drives with SMART enabled as I was using an old 6 or 7 year old IDE hard drive when i first tested this code, and the second harddrive serial code included in the project above is totally different code from the link you posted, and is also API but as mentioned does not work in limited mode.
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by
Deliriumxx
The code provided with old and new method does not work on Vista and Windows 7 :(
@roy: As Deliriumxx said in above post and also I test roy's code (using API then WMI) in vista/windows7 (w/o Run as Administrator mode). The HDD Serial return Bank.
May you test the code in Vista and W7 again?
Thanks!
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
as this is an old thread resurrected, you should make clear who you are addressing, people who posted in this thread originally may not still be active in the forum
i have tested wmi in both vista and windows7 (home premium) as a limited user, works in both, but the return strings have to be decoded
in vista the return is in ascii
but in widows 7 the return is a hex string
in either case it easy to process the return to get the correct value
should be able to figure from the length of the return whether it is ascii or hex
as admin user the correct value was returned directly from the wmi query in vista, have not tried that yet in windows 7
i have also made an api version that asks for elevation, then it works correctly with admin password provided
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
Originally Posted by
westconn1
i have tested wmi in both vista and windows7 (home premium) as a limited user, works in both, but the return strings have to be decoded
in vista the return is in ascii
but in widows 7 the return is a hex string
in either case it easy to process the return to get the correct value
should be able to figure from the length of the return whether it is ascii or hex
as admin user the correct value was returned directly from the wmi query in vista, have not tried that yet in windows 7
i have also made an api version that asks for elevation, then it works correctly with admin password provided
Could you please share the code that return & get correct value in both vista and w7?
And provide me the solution "api version that asks for elevation, then it works correctly with admin password provided"
TIA
P/S: Anyone know how to get Physical LAN Adapter (MAC Address). I have the code but it sometime get VMW Adapter, sometime get Wireless Adapter and sometime get LAN Adapter (happen when I disable and enable again the LAN adapter). In most case I want to return Physical LAN Adapter only (Not other if LAN adapter is enable). I don't know why sometime Wireless Adapter have adapter index smaller than the Physical LAN adapter.
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
vb Code:
Set WMIObjectSet = GetObject("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_PhysicalMedia")
For Each wmiobject In WMIObjectSet
s = wmiobject.SerialNumber
sn = ""
If Not IsNull(s) Then
If Len(s) > 20 Then
For i = 1 To Len(s) Step 4 ' windows 7
sn = sn & Chr("&h" & Mid(s, i + 2, 2)) & Chr("&h" & Mid(s, i, 2))
Next
ElseIf Len(s) = 20 Then
For i = 1 To Len(s) Step 2 ' vista
sn = sn & Mid(s, i + 1, 1) & Mid(s, i, 1)
Next
Else: sn = s ' where string returned directly
End If
MsgBox wmiobject.Tag & " : " & Trim(sn)
End If
Next
Set WMIObjectSet = Nothing
End Sub
Quote:
And provide me the solution "api version that asks for elevation
you need to follow all instructions for adding manifests to your exe, these are discussed in many places in this forum, all apps should now have this to be vista and windows 7 aware, as this is not just some vb code, but requires a tutorial, you will need to research it
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
Quote:
vb Code:
If Not IsNull(s) Then
If Len(s) > 20 Then
For i = 1 To Len(s) Step 4 ' windows 7
sn = sn & Chr("&h" & Mid(s, i + 2, 2)) & Chr("&h" & Mid(s, i, 2))
Next
ElseIf Len(s) = 20 Then
For i = 1 To Len(s) Step 2 ' vista
sn = sn & Mid(s, i + 1, 1) & Mid(s, i, 1)
Next
Many thanks, how about the BIOS & Motherboard Serials in Vista & Windows 7?
-
Re: How can know Manufacture Hardware ID (Serial Number) of Disk or MotherBord etc
you can get with wmi, tested as a limited user in windows 7, there are several threads on this on the forum, most show the same code
"select * from win32_baseboard"
on my laptop the serial number for the bios is the same as the baseboard, i have no idea what that means