Source language: Translate to:

Extract MachinID

Questions related to the distribution, marketing and selling of applications created with NeoBook. (Formally titled: "Making Money with NeoBook")

Moderators: Neosoft Support, Wrangler

Extract MachinID

Postby haditavakkoli » Tue Jan 27, 2009 11:42 pm

Hi
I need to extract hard disk serial number to use for MachinID
how can do it ?
User avatar
haditavakkoli
 
Posts: 6
Joined: Sun Jan 25, 2009 1:50 pm

Postby HPW » Wed Jan 28, 2009 12:15 am

There is a global variable [HDSerialNum] .
There is a list of variables in the help file.
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby haditavakkoli » Wed Jan 28, 2009 11:27 am

HPW wrote:There is a global variable [HDSerialNum] .
There is a list of variables in the help file.


Thanks
another question ? this code is retrive Hard Disk serial number or drive number ? and this code are changed when drive is formatted ?
User avatar
haditavakkoli
 
Posts: 6
Joined: Sun Jan 25, 2009 1:50 pm

Postby Neosoft Support » Wed Jan 28, 2009 12:06 pm

[HDSerialNum] is the serial number of the PC's C: drive. This is a random number generated by Windows/DOS when the drive is formatted. If you reformat the drive, the serial number will change.

As far as I know there is no universal "machine ID". Usually this is the serial number of the C: drive, or the MAC Address (Physical Address) of the first Ethernet adapter.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Wrangler » Thu Jan 29, 2009 9:46 am

I think the only permanent ID is the bios number. I don't think this number changes. I know Ron Marie's rtProtectmngt plug will read this number. But I don't know if it will work in Vista.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Neosoft Support » Thu Jan 29, 2009 11:53 am

That's a good idea. Here is a VBScript function to retrieve the BIOS serial number:

Code: Select all
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")

For each objBIOS in colBIOS
  publication.nbSetVar "[BIOSSerialNum]", objBIOS.SerialNumber
Next


I'm not sure if the BIOS serial number available for all manufacturers or not. Does anyone know for sure?
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Wrangler » Thu Jan 29, 2009 12:07 pm

Cool chunk of vbscript, Dave. Thanks.

All motherboards with a bios will have a bios number. Your system wouldn't pass the post test if it didn't. All hardware drivers and configuration loaded during post are tied to this number. That's why when your cmos battery goes dead, your system won't boot. This number is stored in non-volitile memory (cmos chip), which is powered by this little battery. In fact, this little battery is many times overlooked by those who have boot problems. Even if the batt is not dead, and just weak, it will boot, but Windows seems to behave erratically.

Not 100% on this one, but I think Windows also requires a bios number, and won't boot without one, since it makes bios calls at times.

But I think you can safely say every machine has a bios number.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Neosoft Support » Thu Jan 29, 2009 12:22 pm

...But I think you can safely say every machine has a bios number.


That's good to know. Thank you.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Boo (Gulf Breeze) » Mon Feb 02, 2009 2:02 am

Hi All,

Would it be possible for someone to post a sample Pub demonstrating the VDScript above in actual use?

Thanks,

- Boo
User avatar
Boo (Gulf Breeze)
 
Posts: 99
Joined: Sun May 01, 2005 7:37 am
Location: Gulf Breeze, Florida

Postby Wrangler » Mon Feb 02, 2009 9:43 am

Boo,

Create a new function in the Function Editor, copy and paste the above code into it. When you call the function, [BIOSSerialNum] will contain the machinID.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby David de Argentina » Mon Feb 02, 2009 10:07 am

Hi all,

Bad news: on My AMD 64 3200+ motherboard MSI K8T Neo2-F 2.0 does not return any value...

I had Dimensioned the VBScript variables... and the result is the same


Code: Select all
dim strComputer
dim objWMIService
dim colBIOS
dim objBIOS

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")

For each objBIOS in colBIOS
  publication.nbSetVar "[BIOSSerialNum]", objBIOS.SerialNumber
Next


Any ideas ?

David de Argentina
User avatar
David de Argentina
 
Posts: 1562
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby Wrangler » Mon Feb 02, 2009 10:38 am

After some quick research, apparently I was correct about every system having a number, but different bios manufacturers store this info in different memory locations. All store it in the last 8kb of the first megabyte of memory.

I don't know much about vbscript. Maybe this has something to do with it.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Boo (Gulf Breeze) » Mon Feb 02, 2009 2:49 pm

Thanks Wrangler. (FYI: I have not played around with VDScript in Neobook--YET!)

Cheers,

- Boo
User avatar
Boo (Gulf Breeze)
 
Posts: 99
Joined: Sun May 01, 2005 7:37 am
Location: Gulf Breeze, Florida

Postby Wrangler » Mon Feb 02, 2009 3:11 pm

I just had the time to try that vbscript above, but it doesn't work for me. Is that script usable as is, or does something need to be changed?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby dpayer » Tue Feb 03, 2009 6:48 am

Wrangler wrote:I just had the time to try that vbscript above, but it doesn't work for me. Is that script usable as is, or does something need to be changed?


Here is another way to "skin this cat" :)

Although it is not a VB script, it utilizes the WMI (Windows Management Interface) that is built into Windows since 2000 (I think - need to verify) in a similar way to the VB script Dave posted. It is the command line version of WMI ------> wmic.exe

Some day, I may be ambitious and attempt to make this into a VB library for NB of all the WMI functions because much of the work has already been done by others in VB script. Until then, you will find it helpful to use the command line version of WMI.

You could run a batch file that includes this statement:
Code: Select all
wmic bios list >myfile.txt


and then parse the resulting file (ie. myfile.txt) for your unique bios identifier. I believe it will be in there for any computer. The file will have two lines. The first line is the column identifier and the second line is the values. (Remember, if you view in a program that adds linebreaks automatically, it will not appear as only two lines.)

David P

here is a sample with an obfuscated serial number so my boss does not get nervous. (hint - the 55ABC99 is the serial number but simply doing a copy/paste from this form loses the spacing/tabs of the original 'myfile.txt'):

BiosCharacteristics BuildNumber CodeSet CurrentLanguage Description IdentificationCode InstallableLanguages InstallDate LanguageEdition ListOfLanguages Manufacturer Name OtherTargetOS PrimaryBIOS ReleaseDate SerialNumber SMBIOSBIOSVersion SMBIOSMajorVersion SMBIOSMinorVersion SMBIOSPresent SoftwareElementID SoftwareElementState Status TargetOperatingSystem Version
{4, 7, 8, 9, 11, 12, 15, 16, 24, 26, 27, 28, 29, 30, 32, 33, 34, 39, 40, 41} en|US|iso8859-1 Phoenix ROM BIOS PLUS Version 1.10 A04 1 {"en|US|iso8859-1"} Dell Inc. Phoenix ROM BIOS PLUS Version 1.10 A04 TRUE 20051227000000.000000+000 55ABC99 A04 2 3 TRUE Phoenix ROM BIOS PLUS Version 1.10 A04 3 OK 0 DELL - 27d50c1b
User avatar
dpayer
 
Posts: 1384
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Next

Return to Distributing, Marketing and Selling NeoBook Applications

Who is online

Users browsing this forum: No registered users and 1 guest

cron