Unique computer id
Ken Ray
kray at sonsothunder.com
Thu Jul 21 12:29:00 CDT 2005
On 7/21/05 10:59 AM, "Shari" <shari at gypsyware.com> wrote:
>> Well, AFAIK what you're getting is two different pieces of information. In
>> Test One and Test Three, you're getting the MAC Address from the installed
>> network interface card (NIC), and in Test Two, you're getting the serial
>> number of the hard disk.
>>
>> One thing to keep in mind with getting MAC Addresses - a person may have
>> more than one, especially if they have both a standard Ethernet NIC as well
>> as a card for wireless network connections (like I do). So when I do
>> IPCONFIG /all, I get *two* line items that say "Physical Address".
>>
>> And since it is more likely that cards will be removed/replaced than hard
>> drives, I'd stick with getting the hard disk serial number (with all the
>> appropriate caveats, of course).
>>
>>
>> Ken Ray
>> Sons of Thunder Software
>
> Ken,
>
> I actually ran into that problem on a wireless network. One fellow
> apparently puts his card in and takes it out regularly, presumably
> when he travels.
>
> Originally the goal was to find a unique id that I could get from any
> system, Mac or PC. And the MAC address seemed to be the one.
> Apparently not. That's why I put the Windows serial number as a
> backup. I'd rather get a serial number than a MAC address, but it
> seemed to only work on Windows.
>
> With Mac OSX, from everything I could find, one had to go into the
> Profiler Program, which is more hassle, slows the whole process down,
> etc. If anyone posted a shell call, I would have tried it.
Try this... (cross-platform (OSX/Windows), too! Watch for line breaks):
on mouseUp
switch (the platform)
case "MacOS" --OS X only
put stsGetSerialNumber() into tSerialNum -- gets machine s/n
break
case "Win32"
put stsGetSerialNumber("C:") into tSerialNum
break
end switch
answer "The serial number is:" && tSerialNum
end mouseUp
function stsGetSerialNumber pParam
local tID
switch (the platform)
case "MacOS"
if isOSX() then
if (pParam = "") or (pParam="machine") then
put shell("system_profiler SPHardwareDataType") into tData
put matchText(tData,"(?s)Serial Number:\W*(.*?)\n",tID) into
tIsMatch
else
put pParam into tDriveName
put shell("system_profiler SPIDEDataType") into tData
put lineOffset(tDriveName & ":",tData) into tLine
put false into tIsMatch
repeat with x = tLine down to 1
put line x of tData into tDataLine
if tDataLine contains "Serial Number:" then
put matchText(tDataLine,"(?s)Serial Number:\W*(.*?)$",tID) into
tIsMatch
exit repeat
end if
end repeat
end if
else
-- No OS 9 version yet
end if
break
case "Win32"
if pParam = "" then put "C:" into tDriveLetter
else put pParam into tDriveLetter
if length(tDriveLetter) = 1 then put ":" after tDriveLetter
set the hideConsoleWindows to true
if the shellCommand <> "command.com" then
put shell(tDriveLetter && "& dir") into tData
else
put "c:\temp.bat" into tBatPath
put tDriveLetter & cr & "dir" into url ("file:" & tBatPath)
put shell("start" && tBatPath) into tData
delete file tBatPath
end if
put matchText(tData,"(?s)Serial Number is\W*(.*?)\n",tID) into tIsMatch
break
end switch
if tIsMatch then
return tID
else
return "Error: Can't locate serial number."
end if
end stsGetSerialNumber
function isOSX
set the itemDel to "."
return (item 1 of the systemVersion >=10)
end isOSX
HTH,
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the metacard
mailing list