Page 1 of 2

Serial Number

Posted: Wed Nov 25, 2020 3:09 am
by MIGUELON
Hello everyone, I need to know the serial number of a computer to control the licenses of my software
In a DOS window with the CMD command typing:
wmic bios get serialnumber
It gives me this information but I would like to have the serial number directly from my application in Xbase ++
Any ideas ??

Greetings to all and Merry Christmas

Re: Serial Number

Posted: Wed Nov 25, 2020 5:42 am
by Victorio
several ways>
one read it from registry
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Lenovo\MachineInfo
second create output file from command line prompt wmic bios get serialnumber >tempfile1
and read SN from it
and third with llCall("Xpprt1.dll",..., "...") but I do not know parameter for SN , also I do not sure if it is possible, but I use it for read number of CPU cores like this :
i := DllCall("Xpprt1.dll",DLL_CDECL, "_sysGetCPU")

Re: Serial Number

Posted: Wed Nov 25, 2020 8:26 am
by MIGUELON
Thank you very much for the solutions provided
I cannot use the first one because it refers to a type of computer in the Windows registry "LENOVO" and my clients have different brands
The second option is the one I have implemented but it doesn't work with> File Name.
It works like this:
wmic /output:filename bios get serialnumber
The third solution is the one I would like to implement but like you I don't know how to do it
Thanks a lot

Re: Serial Number

Posted: Wed Nov 25, 2020 8:30 am
by reganc
On this topic, I saw the following command line which I also thought was interesting:

wmic baseboard get product,version,serialnumber

Re: Serial Number

Posted: Wed Nov 25, 2020 8:45 am
by rdonnay
wmic baseboard get product,version,serialnumber
That's cool. Works good.

Re: Serial Number

Posted: Wed Nov 25, 2020 9:27 am
by skiman
Hi,

Create a serial.bat from your application. This should contain 2 lines:
1. goto to the path you want.
2. execute wmic /output:filename bios get serialnumber

Start this serial.bat from your application.
Read the filename that is created. It will be available in the folder you specified in the bat file.

Re: Serial Number

Posted: Wed Nov 25, 2020 9:44 am
by MIGUELON
This option works but I would like to know if we can improve it
Thank you all for your ideas

********************
function CualEsElNumeroDeSerie
********************
local nPuntero,cLinea:=space(60)
runshell('/C wmic /output:Serie.SIL bios get serialnumber',,.f.,.t.)
nPuntero:=fopen("Serie.sil", FO_READ )
fread(nPuntero,@cLinea,60)
cLinea:=substr(strtran(cLinea,chr(0),""),15,20)
fclose(nPuntero)
return(cLinea)

Re: Serial Number

Posted: Wed Nov 25, 2020 1:50 pm
by Auge_Ohr
hi,
I need to know the serial number of a computer to control the licenses of my software
WOW you have Software which need "Protection" ...
than you ask for a "safe" Way ... but if i answer you everybody will read it ;)

---

i donĀ“t think that WMI give you a "Serial" which "make sense" to "identify" a PC.
here are 13 x WMI Sourve which have "Serial" inside
WMI_SERIAL.ZIP
(17.54 KiB) Downloaded 579 times

Re: Serial Number

Posted: Thu Nov 26, 2020 1:47 am
by Tom
Create a serial.bat from your application.
Working with batch files/jobs is not a good idea. It was in the eighties, nineties, but today, it's a little like using a fax device. ;)

Re: Serial Number

Posted: Thu Nov 26, 2020 4:34 am
by messaoudlazhar
Hi,

Insert this line then read the file 'BiOsSern.txt' containing the serial number :

RunShell('/C wmic Bios Get SerialNumber >BiOsSern.txt',,,.T.)

Good work

Messaoud Mohamed Lazhar