code:
break on
Do
$nic=0
do
$mygw=enumipinfo($nic,3) $ip=enumipinfo($nic,0) $NicDesc=enumipinfo($nic,2)
select
Case $mygw="192.168.84.129" $Location="01" $city="Pensacola"
Case $mygw="192.168.61.17" $Location="02" $city="Panama City"
Case $mygw="192.168.5.1" $Location="02" $city="St Augustine"
Case $mygw="192.168.61.1" $Location="02" $city="Panama City"
Case $mygw="192.168.200.129" $Location="03" $city="Alachua"
Case $mygw="192.168.61.193" $Location="03" $city="Ocala"
Case $mygw="192.168.61.225" $Location="03" $city="Ocala"
Case $mygw="192.168.85.1" $Location="04" $city="Jacksonville"
Case $mygw="192.168.39.129" $Location="05" $city="St Petersburg"
Case $mygw="192.168.163.129" $Location="05" $city="St Petersburg"
Case $mygw="192.168.34.1" $Location="06" $city="Tampa"
Case $mygw="192.168.41.129" $Location="07" $city="Orlando"
Case $mygw="192.168.103.1" $Location="08" $city="Ft Myers"
Case $mygw="192.168.33.1" $Location="09" $city="W Palm Beach"
Case $mygw="192.168.163.193" $Location="09" $city="W Palm Beach"
Case $mygw="192.168.28.1" $Location="10" $city="Ft Lauderdale"
Case $mygw="192.168.106.1" $Location="11" $city="Miami"
Case $mygw="192.168.63.225" $Location="11" $city="Miami"
Case $mygw="192.168.7.1" $Location="Killearn Ctr-2nd Fl" $city="TLH"
Case $mygw="192.168.11.1" $Location="Bldg1-1st Fl" $city="TLH"
Case $mygw="192.168.12.1" $Location="Bldg1-2nd Fl" $city="TLH"
Case $mygw="192.168.13.1" $Location="Bldg1-3rd Fl" $city="TLH"
Case $mygw="192.168.37.1" $Location="Bldg2-1st Fl" $city="TLH"
Case $mygw="192.168.22.1" $Location="Bldg2-2nd Fl" $city="TLH"
Case $mygw="192.168.31.1" $Location="Bldg3-1st Fl" $city="TLH"
Case $mygw="192.168.32.1" $Location="Bldg3-2nd Fl" $city="TLH"
Case $mygw="192.168.33.1" $Location="Bldg3-3rd Fl" $city="TLH"
Case $mygw="192.168.34.1" $Location="Bldg3-1st Fl" $city="TLH"
Case $mygw="192.168.35.1" $Location="Bldg3-2nd Fl" $city="TLH"
Case $mygw="192.168.36.1" $Location="Bldg3-3rd Fl" $city="TLH"
Case $mygw="192.168.42.1" $Location="Bldg4" $city="TLH"
Case $mygw="192.168.56.1" $Location="TLH Servers" $city="TLH"
Case $mygw="192.168.57.1" $Location="TLH RAS" $city="TLH"
Case @ras $Location="RAS" $city="TLH"
Case 1 $Location="00" $city=""
endselect
$nic=val($nic)+1
until $Location <> "00" or val($nic) > 10
$Mac =WMIQuery("MACAddress","Win32_NetworkAdapterConfiguration",,"Description",$NicDesc)
$Mac =join(split($mac,':'),'')
$Mac =left($mac,instr($mac,'|')-1)
$HD =WMIQuery("Size","Win32_DiskDrive")
$hdGB =left($hd,len($hd)-9)
$hdMBfr =GetDiskSpace("c:")/1000
$Video =WMIQuery("Description","Win32_VideoController")
$Printer=WMIQuery("DriverName","Win32_Printer",,"SystemName","@wksta")
$modem =WMIQuery("Description","Win32_POTSModem",,"Status","OK")
$Biosv =WMIQuery("SMBIOSBIOSVersion","Win32_BIOS")
$biosd =WMIQuery("Version","Win32_BIOS")
$Make =trim(split(WMIQuery("Manufacturer","Win32_ComputerSystem"))[0])
$Model =trim(WMIQuery("Model","Win32_ComputerSystem"))
select
case instr("$model","pro") $case="Desktop"
case instr("$model","evo") $case="Desktop"
case instr("$model","lat") $case="Laptop"
case 1 $case="Not Specified"
endselect
$asset =WMIQuery("SMBIOSAssetTag","Win32_SystemEnclosure")
if instr($asset,"|")
for each $return in split($asset,"|")
if $return $asset=$return endif
next
endif
$SerNo =WMIQuery("SerialNumber","Win32_BIOS")
if len($SerNo) < 2
$SerNo=WMIQuery("SerialNumber","Win32_SystemEnclosure")
if instr($serno,"|")
for each $return in split($serno,"|")
if len($return)<10 $serno=$return endif
next
endif
endif
$SerNo =trim(ucase($SerNo))
$CPUsp =WMIQuery("CurrentClockSpeed","Win32_Processor")
if instr($CPUsp,"239") $CPUsp=2400 endif
if instr($CPUsp,"179") $CPUsp=1800 endif
if instr($CPUsp,"106") $CPUsp=1100 endif
if instr($CPUsp,"702") $CPUsp=700 endif
if instr($CPUsp,"39") $CPUsp=400 endif
$dimms =Split(WMIQuery("Capacity","Win32_PhysicalMemory"),"|")
for $a=0 to ubound($dimms)
$=execute("$$dimm$a=val($$dimms[$a]) / 1048576")
$=execute("$$memory=val($$Memory)+val($$dimm$a)")
next
$ier =readvalue("HKLM\Software\Microsoft\Internet Explorer", "Version")
$MSOdir =readvalue("HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\excel.exe","Path")
$access =getfileversion("$MSOdir\msaccess.exe")
$excel =getfileversion("$MSOdir\excel.exe")
$outlook =getfileversion("$MSOdir\outlook.exe")
$powerpnt =getfileversion("$MSOdir\powerpnt.exe")
$pub =getfileversion("$MSOdir\mspub.exe")
$Word =getfileversion("$MSOdir\winword.exe")
$vscanver =readvalue("HKLM\Software\Network Associates\TVD\VirusScan","szCurrentVersionNumber")
$vscaneng =readvalue("HKLM\Software\Network Associates\TVD\Shared Components\VirusScan Engine\4.0.xx","szEngineVer")
$vscandat =readvalue("HKLM\Software\Network Associates\TVD\Shared Components\VirusScan Engine\4.0.xx","szDatVersion")
if keyexist('HKLM\SOFTWARE\Cognos')
$cogdir=readvalue('HKLM\SOFTWARE\Cognos','CognosIni')
if right($cogdir,2)='..' $cogdir=split($cogdir,'..')[0] endif
$impver=getfileversion($cogdir+'bin\impuser.exe')
endif
$aspenexe=readvalue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\ASE.exe','')
if exist($aspenexe) $asefiletime=getfiletime($aspenexe) endif
$acroexe=readvalue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe','')
if exist($acroexe) $acrobat=getfileversion($acroexe) endif
$keyindex = 0 $done = 0 $hotfix = ''
do
$subkeyindex = 0
$subdone = 0
$key = enumkey('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000',$keyindex)
if not @error
do
$subkey = enumkey('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\$key',$subkeyindex)
if not @error
$hotfix = $hotfix + ',' + $subkey
else
$subdone = 1
endif
$subkeyindex = $subkeyindex + 1
until $subdone = 1
else
$done = 1
endif
$keyindex = $keyindex + 1
until $done
$hotfix = right($Hotfix,len($hotfix)-1)
$rc = SRND(@ticks)
$delay = 3600*8 ; minutes*hours
$rdelay = rnd(3600)*@wdayno
$delay = $rdelay + $delay ; minutes*random 1 - 7 hours
$=writevalue('HKLM\Software\Inventory Client','Last Inventory Date',@date,REG_SZ)
$=writevalue('HKLM\Software\Inventory Client','Last Inventory Time',@time,REG_SZ)
$=writevalue('HKLM\Software\Inventory Client','Next Inventory in Seconds',$delay,REG_SZ)
$=writeprofilestring("%windir%\Inventory.ini","Inventory","Date",@Date)
$=writeprofilestring("%windir%\Inventory.ini","Inventory","Time",@time)
$=writeprofilestring("%windir%\Inventory.ini","Network","IPAddress",$IP)
$=writeprofilestring("%windir%\Inventory.ini","Network","Mac",$Mac)
$=writeprofilestring("%windir%\Inventory.ini","Network","Adapter",$NicDesc)
$=writeprofilestring("%windir%\Inventory.ini","Network","Location",$location)
$=writeprofilestring("%windir%\Inventory.ini","Network","City",$city)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","ComputerName",@wksta)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","Make",$Make)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","Model",$Model)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","Case",$Case)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","SerialNumber",$SerNo)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","AHCATag",$Asset)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","BIOS",$Biosv)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","ProcessorSpeed",$CPUsp)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","HDSize",$hdGB)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","MBFree",$hdmbfr)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","Dimm0",$dimm0)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","Dimm1",$dimm1)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","Dimm2",$dimm2)
$=writeprofilestring("%windir%\Inventory.ini","Hardware","Modem",$modem)
$=writeprofilestring("%windir%\Inventory.ini","Software","OS",@producttype)
$=writeprofilestring("%windir%\Inventory.ini","Software","SP",@csd)
$=writeprofilestring("%windir%\Inventory.ini","Software","Hotfixes",$hotfix)
$=writeprofilestring("%windir%\Inventory.ini","Software","MSAccess",$access)
$=writeprofilestring("%windir%\Inventory.ini","Software","MSExcel",$excel)
$=writeprofilestring("%windir%\Inventory.ini","Software","MSOutlook",$outlook)
$=writeprofilestring("%windir%\Inventory.ini","Software","MSPowerpoint",$powerpnt)
$=writeprofilestring("%windir%\Inventory.ini","Software","MSPublisher",$pub)
$=writeprofilestring("%windir%\Inventory.ini","Software","MSWord",$word)
$=writeprofilestring("%windir%\Inventory.ini","Software","InternetExplorer",$ier)
$=writeprofilestring("%windir%\Inventory.ini","Software","McAfeeVersion",$vscanver)
$=writeprofilestring("%windir%\Inventory.ini","Software","McAfeeEngine",$vscaneng)
$=writeprofilestring("%windir%\Inventory.ini","Software","McAfeeDAT",$vscandat)
$=writeprofilestring("%windir%\Inventory.ini","Software","Impromptu",$Impver)
$=writeprofilestring("%windir%\Inventory.ini","Software","AspenFiletime",$asefiletime)
$=writeprofilestring("%windir%\Inventory.ini","Software","AdobeAcrobat",$acrobat)
$=logevent(0,18001,"Inventory Completed Successfully",,"Inventory Client")
sleep $delay
until @error
;*************************************************************************************************************************
FUNCTION WMIQuery($what,$from,optional $computer,optional $where, optional $x)
dim $strQuery, $objEnumerator, $value
if not $computer $computer="@WKSTA" endif
$strQuery = "Select $what From $from"
if $where and $x $strQuery = $strQuery + " Where $where = '$x'" endif
$SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer")
$objEnumerator = $SystemSet.ExecQuery($strQuery)
For Each $objInstance in $objEnumerator
If @Error = 0 and $objInstance <> ""
$=execute("$$value = $$objInstance.$what")
$WMIQuery="$value"+"|"+"$WMIQuery"
EndIf
Next
$WMIQuery=left($WMIQuery,len($WMIQuery)-1)
exit @error
ENDFUNCTION