I am writing an application in Visual Basic that pulls basic information about the computer and outputs the data onto a form. Currently, I am trying to pull the serial number for the machine I would be using. For example, pulling a serial number of a laptop from the BIOS. I have looked around the internet and haven't really found how to do this in Visual Basic without using WMI or C. Is there a way to do this in Visual Basic?
Below is what I have currently in the form, so you can get an idea of what I am trying to do:
Thank you all so much!
![Serial Serial](https://ftp.softwaretoolbox.com/support/images/Answer1622_ActiveX_GetSerialNumber.gif)
4 Answers
This will work for you just great! First add reference to System.Management and then make sure to import it at the top of your class as well. I did this on a form load event, but you can put it anywhere...
You can declare a string first if you would like and then set it to: info('serialnumber').ToString and the set that to you txtSerial.Text = your declared string
Here is what I get...
This is VBScript but should be pastable into VB6.
You do know this field is blank on many computers?
From a command prompt (but I don't think home editions get the console program wmic)
or
Try to use Treek's Licecnsing Library. It has class for generating hardware serial.
I found a way to get to this a bit backwards in VBA, using the FileSystemObject
. You will need to set a reference to the Windows Scripting Runtime.
This does not account for multiple physical drives, which wasn't a problem in my environment.
Not the answer you're looking for? Browse other questions tagged vb.netvisual-studio-2010vbavb6hardware or ask your own question.
I have a problem with a tool called GetDiskSerial. For more information about this software please check this link: http://devlib.net/getdiskserial.htm.
With this tools we can retrive all information (like SN,Device Name,Model and....)
and my problem is that when I check my device serial number it does not show my serial correctly. getdiskserial has an example of this.
For example, I have an external hard disk that its SN is 8600213005052211041.
It shows 8600213005052211041S that has an extra character 'S'
Vb6 Get Motherboard Serial Number
And for model it shows ilicon-Power that has missed charachter 'S',so this 'S' were added to serial.I uploded this image for more info: this link
getdiskserial has a lot demo source code in many type of language program. I tried to solve my problem by checking its code and I found out that this problem is caused by its modules.In its modules, it has a function like this:
End Typethat when I change the value of size of these it show different serial, like this:8600213005052211041Sil.
My dear friends, I am so sorry for my request and so sorry for my bad English. Please download and check GetSerialDisk to find out how to solve this bug.
![Adobe Adobe](https://i.stack.imgur.com/2gZTg.jpg)
So, thanks.
Browse other questions tagged vb6 or ask your own question.
I have to write a Visual Basic 6.0 Program and need to uniquely identify a
computer in a network and the user mustn't be able to change that id while my
program is running. So the Volume Serial Number of the HDD isn't a possibility,
because you can set the Volume SN whatever you want and therefore it's not
unique in a Network. I heard that there's a manufacturer's Serial Number on the
HDD that can't be changed and that is unique (worldwide?). How can I get that SN
with VB6? Or do you have any other ideas? Like a BIOS SN?
Thanks a lot in advance,
Michael
PS: Answer in German is ok.