tarus
Fresh Scripter
Registered: 2002-06-14
Posts: 12
|
I think I'm going to use the WriteLine command instead from now on.
Never posted code before, so here it goes:
code:
SetConsole("HIDE")
$time = @TIME $date = @DATE $new_time = trim(substr($time, 1, 2)) + trim(substr($time, 4, 2)) + trim(substr($time, 7, 2)) $new_date = trim(substr($date, 1, 4)) + trim(substr($date, 6, 2)) + trim(substr($date, 9, 2))
$sysinfo_file_location = "\\helios\test\testO\SysInfo\$new_date $new_time @WKSTA" $comp_info_directory_location = "\\helios\test\testO\compinfo" $comp_info_file_location = "\\helios\test\testO\compinfo\@WKSTA\$new_date $new_time"
$index=0 $enumsubkeys="" $enumsubsubkeys="" $enumsubsubsubkeys="" $class="" $devicedesc=""
; #### Part A #### This part reads HKLM\Enum for device names and writes them to $sysinfo_file_location if (substr(@producttype,1,10) <> "Windows NT") if (RedirectOutput($sysinfo_file_location) = "0") :loop1 $enumsubkeys=enumkey("HKEY_LOCAL_MACHINE\Enum", $index) if @error=0 $index2=0 :loop2 $enumsubsubkeys=enumkey("HKEY_LOCAL_MACHINE\Enum\$enumsubkeys", $index2) if (@error=0 and $index2<30) $index3=0 :loop3 $enumsubsubsubkeys=enumkey("HKEY_LOCAL_MACHINE\Enum\$enumsubkeys\$enumsubsubkeys", $index3) $class=readvalue("HKEY_LOCAL_MACHINE\Enum\$enumsubkeys\$enumsubsubkeys\$enumsubsubsubkeys","Class") $devicedesc=readvalue("HKEY_LOCAL_MACHINE\Enum\$enumsubkeys\$enumsubsubkeys\$enumsubsubsubkeys","DeviceDesc") if (@error=0 and $index3<30) if $class <> "system" ? $class + "," + $devicedesc endif $index3=$index3+1 goto loop3 endif $index2=$index2+1 goto loop2 endif $index=$index+1 goto loop1 endif endif endif ; #### Part A End ####
md "$comp_info_directory_location\@WKSTA" ; ## just in case the directory doesn't exist if (RedirectOutput($comp_info_file_location) = "0") dim $index, $freec, $freed, $os_type, $os_SP, $os_suite, $uptime, $HKLMAppPaths, $app, $path, $vscan, $vscan_dat, $vscan_engine, $epoagent, $netshieldnt, $winword, $excel, $powerpnt, $msaccess, $outlook, $mspub, $winproj, $visio32
; ####### Get MS Office version information ####### $excel = "none" $winword = "none" $powerpnt = "none" $msaccess = "none" $outlook = "none" $mspub = "none" $winproj = "none" $visio32 = "none"
$HKLMAppPaths = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths" $index=0 while @error = 0 $app = enumkey("$HKLMAppPaths",$index) $index = $index + 1 select case $app = "winword.exe" $path = readvalue("$HKLMAppPaths\$app","path") $winword = getfileversion("$path\$app","Productversion") case $app = "excel.exe" $path = readvalue("$HKLMAppPaths\$app","path") $excel = getfileversion("$path\$app","Productversion") case $app = "powerpnt.exe" $path = readvalue("$HKLMAppPaths\$app","path") $powerpnt = getfileversion("$path\$app","Productversion") case $app = "msaccess.exe" $path = readvalue("$HKLMAppPaths\$app","path") $msaccess = getfileversion("$path\$app","Productversion") case $app = "outlook.exe" $path = readvalue("$HKLMAppPaths\$app","path") $outlook = getfileversion("$path\$app","Productversion") case $app = "mspub.exe" $path = readvalue("$HKLMAppPaths\$app","path") $mspub = getfileversion("$path\$app","Productversion") case $app = "winproj.exe" $path = readvalue("$HKLMAppPaths\$app","path") $winproj = getfileversion("$path\$app","Productversion") case $app = "visio32.exe" $path = readvalue("$HKLMAppPaths\$app","path") $visio32 = getfileversion("$path\$app","Productversion") endselect loop ; ####### MS Office Version Info taken #######
; ####### Anti-Virus Info ####### $path = ReadValue("HKEY_LOCAL_MACHINE\Software\Network Associates\TVD\VirusScan","szInstallDir") if ($path <> "") $vscan = getfileversion("$path\vshwin32.exe") endif $vscan_dat = ReadValue("HKEY_LOCAL_MACHINE\Software\Network Associates\TVD\Shared Components\VirusScan Engine\4.0.xx","szDatVersion") $vscan_engine = ReadValue("HKEY_LOCAL_MACHINE\Software\Network Associates\TVD\Shared Components\VirusScan Engine\4.0.xx","szEngineVer")
$path = ReadValue("HKEY_LOCAL_MACHINE\Software\Network Associates\ePolicy Orchestrator\Agent","Installed Path") if ($path <> "") $epoagent = getfileversion("$path\naimag32.exe") endif
$path = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\NetShield NT\CurrentVersion","szInstallDir") if ($path <> "") $netshieldnt = getfileversion("$path\shstat.exe") endif
; ####### Anti-Virus Info taken #######
; ####### Operating System and SP Info ####### $os_type = @producttype $os_SP = @CSD $os_suite = @productsuite ; ####### Done with Operating System and SP info #######
; ####### Get Free Spaces of C:\ D:\ and E:\ #### $freec = GetDiskSpace("C:\") / 1024 $freed = GetDiskSpace("D:\") / 1024 ; ####### Free Spaces of C:\ D:\ and E:\ done ####
$old_ipaddr = @IPADDRESS0 $new_ipaddr = (LTRIM(SUBSTR($old_ipaddr,1,3))) + "." + (LTRIM(SUBSTR($old_ipaddr,5,3))) + "." + (LTRIM(SUBSTR($old_ipaddr,9,3))) + "." + (LTRIM(SUBSTR($old_ipaddr,13,3))) $uptime = @TICKS/60000
? "@WKSTA,$new_ipaddr,@ADDRESS,@DOMAIN,@DATE,@TIME,@USERID,$freec,$freed,$os_type,$os_SP,$os_suite,$uptime,$vscan,$vscan_dat,$vscan_engine,$epoagent,$netshieldnt,$excel,$winword,$powerpnt,$msaccess,$outlook,$mspub,$winproj,$visio32" endif
exit 0
|