B4J Library (b4j)[juuid] Get Unique hardware ID

B4XDev

Member
Licensed User

Those are some weird numbers I've not seen before. What format is the serial number?! Is that an immutable ID?
 

B4XDev

Member
Licensed User
Number allocated by the manufacturer to identify the physical media.

Example: WD-WM3493798728

Wow! Is it a unique ID and immutable? It won't change with software updates (like, to the OS) or a reformat?
 

Magma

Expert
Licensed User
Longtime User

B4XDev

Member
Licensed User
i think that not change... "not sure" ... but as search it is totally different from "vol"...

And I cannot tell or get information specifically for a particular drive letter (C, D, etc.). Do you know how to match the drive info from wmic with the drive letter?
 

B4XDev

Member
Licensed User
a little different... not C: or D:... more physical... but if you search you find the way...
B4X:
wmic diskdrive get Name, SerialNumber

I've tried a couple of options (deviceid, serialnumber, systemname, etc...) but none of them return the drive letter that has been assigned to the drive. I will see what I can find searching the interwebs...
 

Magma

Expert
Licensed User
Longtime User
this return the logicaldisks - may be the row-series is the same... not checked... (also you can see the different serial number here)
B4X:
wmic logicaldisk get caption,description,drivetype,providername,volumename,volumeserialnumber
 

Magma

Expert
Licensed User
Longtime User

behnam_tr

Active Member
Licensed User
Longtime User

added !!
Log(Get_HddId4("C"))
download v2.2
 
Last edited:

B4XDev

Member
Licensed User
sorry... this can't be..right i said... because physical drives... can have... more than 1 partition with other names..... so.... can't think something for that... for now..

It's working perfectly! Thank you!
 

behnam_tr

Active Member
Licensed User
Longtime User

thanks for code
i added to lib (v2.3)


B4X:
Dim l As List = p.Get_LocalHardisk_Info
    For i=1 To l.Size-1
        
        Log(l.Get(i))

    Next
 

peacemaker

Expert
Licensed User
Longtime User
Nothing works for Linux, excepting Get_MacId, that are changed after reboot...
No any constant info about Linux really ?

What about this ?
 

Magma

Expert
Licensed User
Longtime User
may be somehow... getting serial number of hdd/ssd or motherboard...

hdd-ssd serial:
lsblk --nodeps -no name,serial


motherboard s/n needs a library (extra apt-get)
sudo dmidecode -t system | grep Serial


ps: Get_MacId changes after reboot ?... how ? do you change it by hand-edit... ???
 

peacemaker

Expert
Licensed User
Longtime User
ps: Get_MacId changes after reboot ?... how ? do you change it by hand-edit... ???

i was debugging yesterday my API sending data from a Linux host to a server, APIkey is based on the HW info to identify the client.
But today API stopped to work, and i see the new MAC from Linux, just after host power up.
No manual actions.
 

behnam_tr

Active Member
Licensed User
Longtime User

I will try to add some methods related to Linux
If there is a method for Linux
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…