Getting the Serial Number of the User's computer

Ken Ray kray at sonsothunder.com
Tue Dec 9 18:30:23 EST 2008



> Never personally used it in anger, but in Linux its dmidecode.
> 
> http://www.thegeekstuff.com/2008/11/how-to-get-hardware-information-on-linux-u
> sing-dmidecode-command/

It seems you can get it by doing "dmidecode -t 1", but it requires
permission, so you would need to "sudo" and provide a password to get it.
The way you do *that*, is (assumes the password is in the variable "tPwd"):

    put "#!/bin/sh" & cr into tScript
    put "pw=" & quote & tPwd & quote & cr after tScript
    put "echo $pw | sudo -S dmidecode -t 1" && tPID & cr after tScript
    put shell(tScript) into tResult
     -- Then parse tResult looking for "Serial Number:"

But given the many Linux distros, would it be safe to say that this may not
work on all distros? I know it doesn't work in a virtual device (when I do
this under VMWare, I don't get any System Information - I get
"HDIO_GET_IDENTITY failed"), but would it work for the most common distros?

Just curious...

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/





More information about the use-livecode mailing list