http://www.nextofwindows.com/the-best-w ... s-machine/
I decided to do what they were doing. I encountered some issues with the encoding (unicode) I was getting back and implented a solution suggested here:
http://superuser.com/questions/812438/c ... formatting
Ultimately I came up with a little function that I thought would be nice to share with everyone. So here it is

Enjoy,
John Bowman
Code: Select all
00010 library program$: fnunique_computer_id$
00020 print 'fn returns '&fnunique_computer_id$
00022 print 'env is '&env$('Unique_Computer_ID')
00030 end
10000 def library fnunique_computer_id$*40
10020 if env$('Unique_Computer_ID')='' then
10040 library 'core\library': fngethandle
10060 dim uci_tmp_filename$*512,tmp_line$*128,uuid$*36,hdd_serial$*36
10080 let uci_tmp_filename$=env$('temp')&'\acs_uuid_tmp'&session$&'.txt'
10100 ! print uci_tmp_filename$
10120 let hdd_serial$=''
10140 let uuid$=''
10160 execute 'sy -m wmic csproduct get UUID |more >'&uci_tmp_filename$
10180 ! execute 'type '&uci_tmp_filename$ : pause
10200 ! execute 'sy -m wmic /output:"'&uci_tmp_filename$&'" csproduct get UUID' <--encoded in something other than ANSI, hard to read
10205 open #h_tmp:=fngethandle: 'name='&uci_tmp_filename$&',EoL=None',display,input
10215 linput #h_tmp: tmp_line$
10220 tmp_line$=srep$(tmp_line$,chr$(10),'~')
10225 tmp_line$=srep$(tmp_line$,chr$(13),'~')
10226 tmp_line$=srep$(tmp_line$,' ','')
10230 do while pos(tmp_line$,'~~')>0
10235 tmp_line$=srep$(tmp_line$,'~~','~')
10240 loop
20000 if tmp_line$(1:4)<>'UUID' then print 'problem in fn_unique_computer_id$ - expected to say UUID' : pause
20020 let uuid$=tmp_line$(6:len(tmp_line$)-1)
20040 close #h_tmp,free:
20060 if uuid$='FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF' then
20080 let uuid_valid=0
20100 execute 'sy -m wmic DISKDRIVE get SerialNumber |more >'&uci_tmp_filename$
20120 ! execute 'sy -m wmic /output:"'&uci_tmp_filename$&'" DISKDRIVE get SerialNumber' <--encoded in something other than ANSI, hard to read
20140 open #h_tmp:=fngethandle: 'name='&uci_tmp_filename$&',EoL=None',display,input
20160 linput #h_tmp: tmp_line$
20180 tmp_line$=srep$(tmp_line$,chr$(10),'~')
20200 tmp_line$=srep$(tmp_line$,chr$(13),'~')
20220 tmp_line$=srep$(tmp_line$,' ','')
20240 do while pos(tmp_line$,'~~')>0
20260 tmp_line$=srep$(tmp_line$,'~~','~')
20280 loop
20300 if tmp_line$(1:12)<>'SerialNumber' then print 'problem in fn_unique_computer_id$ - expected to say SerialNumber' : pause
20340 let hdd_serial$=tmp_line$(14:len(tmp_line$)-1)
20360 close #h_tmp,free:
20380 else
20400 let uuid_valid=1
20420 end if
20440 if uuid_valid then
20460 let setenv('Unique_Computer_ID',uuid$)
20480 else
20500 let setenv('Unique_Computer_ID',hdd_serial$)
20520 end if
20540 end if
20560 let fnunique_computer_id$=env$('Unique_Computer_ID')
20580 fnend