break on;Bios rev checker - Paul Berquam
;This script checks the model number, service tag and bios rev from bios
;tested on CPX laptops and GX110 desktops
GLOBAL $range
GLOBAL $cline
GLOBAL $outlen
GLOBAL $mfname
GLOBAL $first
GLOBAL $diff
GLOBAL $output2
GLOBAL $outlen2
GLOBAL $biosrev
GLOBAL $Biosdate
Global $sysinfo
:setrange
?
? "Is this computer a Dell? (Y/N) "
get $c
select
case ucase($c) = "Y"
? "Is this Dell a laptop or a desktop? (L/D) "
$sysinfo = "C:\Dell\sysinfo.dat"
$MFname = "Dell Computer Corporation"
$CRLF=chr(13)+chr(10)
$mfg = "Dell"
get $c
select
case ucase($c) = "L"
$range = "65a0 67a0"
$biosrevoffset = 1
$biosrevlen = 3
$biosrevdateoffset = 1
$biosdatelen = 10
case ucase($c) = "D"
$range = "0450 0650"
case ucase($c) = "X"
goto end
case 1
endselect
goto dell
case ucase($c) = "N"
$range = "0d00 0f00" ;or
$mfname = "Intel Corp"
$mfname2 = "Intel Corporation"
$biosrevoffset = 2
$biosrevlen = 21
$biosrevdateoffset = 12
$biosdatelen = 8
$sysinfo = "C:\sysinfo.dat"
$stnumber = "None"
goto intel
case 1
endselect
;**********************************************************************
;***
;*** Start Dell Computers
:dell
$currentST = readprofilestring("$sysinfo","ServiceTag","ServiceTag")
if exist("$sysinfo") = 1
$sysinfoexist = "True"
; File not found
else
$sysinfoexist = "False"
endif
gosub getdump
if $first = 0
goto notdell
endif
$second = instr($output2,$mfname)
$diff2 = $second+$mflen+1
$output3 = substr($output2,$diff2,$outlen2-$mflen-1)
$outlen3 = len($Output3)
$third = instr($output3,$mfname)
$STbegin = instr($output3,".")
$model = substr($output2,$diff2,$stbegin-1)
$STnumber = substr($output3,$STbegin+1,10)
$STend = instr($STNumber,".")
$stnumber = substr($stnumber,1,$stend-1)
$stnumber = rtrim($stnumber)
? "Info From Bios" ?
? "$mfname"
? "Model = $model"
? "Service Tag = $Stnumber"
? "Biosrev = $BiosRev"
? "BiosDate = $BiosDate"
?
? "Sysinfo = $sysinfo"
? "Current ST = $currentST"
?
If $currentST <> $stnumber and $sysinfoexist = "True"
?
? "Service tag in Bios differs from the local system"
? "Local file will be updated from $currentst to $stnumber"
copy "$sysinfo" "$sysinfo.old"
$= writeprofilestring("$sysinfo","Servicetag","Servicetag","$stnumber")
if @error = 0
? "File updated successfully"
else
? "There was an error updating the file."
sleep 2
endif
?
endif
;******************************
? "Done"
get $c
quit
exit
:notdell
if $mfg = "Intel"
goto intel
endif
? "This does not appear to be a Dell system"
$mfg = "Intel"
goto setrange
sleep 1
exit
;**********************************************************************
;***
;*** Start Intel
:intel
? "Starting Intel"
;
;$range = 0d00 0f00
gosub getdump
$mflen2 = len(mfname)
$second = instr($output2,$mfname2)
$diff2 = $second+$mflen2+1
$output3 = substr($output2,$diff2,$outlen2-$mflen-1)
$outlen3 = len($Output3)
$modelstart = instr($output3,".")
$model = substr($output3,$modelstart+1,10)
$model = rtrim($model)
? "Info From Bios" ?
? "$mfname"
?
? "Model = $model"
? "Biosrev = $BiosRev"
? "BiosDate = $BiosDate"
?
?
;******************************
? "Done"
get $c
;*******************************************************
:getdump
; Generate DEBUG script
del "c:\temp\debug.scr"
$=open(1, "c:\temp\debug.scr", 5)
$=writeline(1, "d f000:$range"+$CRLF) ; this is the address range in memory
;$=writeline(1, "d f000:0 ffff"+$CRLF)
$=writeline(1, "q"+$CRLF)
$=close(1)
sleep 1
; run script and output to .RES file
shell "cmd /c debug <c:\temp\debug.scr >c:\temp\@wksta.res"
$output = "Begin "
$=open(1, "c:\temp\@wksta.res")
$ = readline(1)
$line = readline(1) ;? "$line"
while $line <> "-q"
$cline =substr($line, 62, 16) ;? "$cline"
$Output = $output + $cline
$line = readline(1)
loop
$=close(1)
$outlen = len($output)
$mflen = len($mfname)
$first = instr($output,$mfname)
$diff = $first+$mflen+$biosrevoffset
$output2 = substr($output,$diff,$outlen-$diff)
$outlen2 = len($output2)
$BiosRev = substr($output,$Diff,$biosrevlen)
$biosdate = substr($output,$diff + $biosrevlen + $biosrevdateoffset,$biosdatelen)
return