; IF setconsole("hide") ; ENDIF ; ; NT/95 inventory software - Kixtart 3.63, 4.00 ; ; (c) scripting@wanadoo.nl - 2001 ; ; vs 1.03 - program ; ; 1.00p (20010415) original version (= 4.12) ; 1.01 (20010701) - minor fix to incorrect substr specification ; 1.02p (20010710) - standardization of $debug_file value ; 1.03p (20011120) - add "windows XP" ; - suppress SetConsole("hide") ; $prgrm_version="1.03" ; $tmp_directory=ExpandEnvironmentVars("%tmp%") IF (substr($tmp_directory,len($tmp_directory),1) = "\") $tmp_directory=substr($tmp_directory,1,len($tmp_directory)-1) ENDIF ; --------------------------------------------------------------------------- ; - site defined settings - ; --------------------------------------------------------------------------- $history_mode="yes" $history_file=$tmp_directory+"\software.log" $log_mode="yes" $log_file=$tmp_directory+"\software.lst" ; $debug_mode="yes" $debug_file=$tmp_directory+"\kix-info.log" ; --------------------------------------------------------------------------- ; - - ; --------------------------------------------------------------------------- $time_start=@time ; $cr=CHR(10) $lf=CHR(13) $eol=$lf ; - $cr+$lf - IF (@inwin = 1) $NT_mode="yes" ELSE $NT_mode="no" ENDIF IF (len(@ipaddress0) = 0) $offline_mode="yes" ELSE $offline_mode="no" ENDIF ; IF (exist($debug_file) = 1) del $debug_file ENDIF ; $os="" $os_dos=@dos SELECT CASE ($NT_mode = "yes") AND ($os_dos = "5.1") ; - Windows XP - $os="XP" CASE ($NT_mode = "yes") AND ($os_dos = "5.0") ; - Windows 2000 - $os="W2K" CASE ($NT_mode = "yes") ; - Windows NT - $os="NT4" CASE ($NT_mode <> "yes") AND ($os_dos = "4.90") ; - Windows ME - $os="ME" CASE ($NT_mode <> "yes") AND ($os_dos = "4.10") ; - Windows 98 - $os="W98" CASE ($NT_mode <> "yes") AND ($os_dos = "4.0") ; - Windows 95 - $os="W95" CASE 1 $os="???" ; - undetermined - ENDSELECT ; -------------------------------------------------------------------------- ; - - ; -------------------------------------------------------------------------- $domain="" $ldomain="" IF ($NT_mode = "yes") $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" IF (existkey($ikey) = 0) $domain=ReadValue($ikey, "DefaultDomainName") ENDIF $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" IF (existkey($ikey) = 0) $ldomain=ReadValue($ikey, "CachePrimaryDomain") ENDIF ELSE $ikey="HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP2\NetworkProvider" IF (existkey($ikey) = 0) $domain=ReadValue($ikey, "AuthenticatingAgent") ENDIF $ikey="HKEY_LOCAL_MACHINE\Security\Provider" IF (existkey($ikey) = 0) $ldomain=ReadValue($ikey, "Container") ENDIF ENDIF IF (len($domain) = 0) IF (len(@ldomain) <> 0) $domain=@ldomain ELSE $domain=@domain ENDIF IF (len($domain) = 0) $domain="~domain" ; - unknown @domain/@ldomain value - ENDIF ENDIF IF (len($ldomain) = 0) $ldomain=$domain ENDIF ; break off MD "c:\temp" IF (@error = 0) ENDIF IF ($debug_mode = "yes") break on ? "KIX-INFO: DEVELOPMENT ("+$os+" - kixtart "+@kix+" vs "+$prgrm_version+")" ? IF (RedirectOutput($debug_file,1) = 0) ENDIF ELSE IF (RedirectOutput("nul",1) = 0) ENDIF ENDIF flushkb IF ($NT_mode = "yes") $time_stop=@time $log_info="Kixtart-info "+$prgrm_version+" script started" $log_info=$log_info+" for '"+LCASE(@userid)+"'" $log_info=$log_info+" ("+$time_start+" - '"+@ipaddress0+"')" IF logevent(0, 1, $log_info, "", "Kixtart INFO @kix") ENDIF ENDIF ; -------------------------------------------------------------------------- ; - special variables settings - ; -------------------------------------------------------------------------- $section=substr(@date,1,4) IF (@ydayno < 10) $section=$section+"00"+@ydayno ELSE IF (@ydayno < 100) $section=$section+"0"+@ydayno ELSE $section=$section+@ydayno ENDIF ENDIF $key=$section+"_" $key=$key+substr(@date,3,2)+substr(@date,6,2)+substr(@date,9,2) $key=$key+"_" $key=$key+@time $key=$key+" "+$domain $x="" $tmp="" IF (len(@ipaddress0) = 0) $x=$x+"("+$os+" - vs "+$prgrm_version+" - off-line )" ELSE IF (len(@lserver) = 0) $lserver="~lserver " ELSE $lserver=@lserver ; - \\spln99999 - ENDIF IF (LCASE($domain) = LCASE($ldomain)) $x=$x+"("+$os+" - vs "+$prgrm_version+" L $domain $lserver)" ELSE $x=$x+"("+$os+" - vs "+$prgrm_version+" - $domain $lserver)" ENDIF ENDIF IF (len(@ipaddress0) = 15) $i=1 $ip_old=@ipaddress0 $ip_new="" DO IF (substr($ip_old,$i,1) <> " ") $ip_new=$ip_new+substr($ip_old,$i,1) ELSE $ip_new=$ip_new+"0" ENDIF $i=$i+1 UNTIL ($i > 15) ELSE $ip_new="xxx.xxx.xxx.xxx" ENDIF $x=$x+" "+$ip_new IF (len(@address) = 0) $address="xxxxxxxxxxxx" ELSE $address=@address ENDIF $x=$x+" "+$address $user="" IF ($NT_mode = "yes") $ikey="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" IF (existkey($ikey) = 0) $user=ReadValue($ikey, "DefaultUserName") ENDIF ELSE $ikey="HKEY_LOCAL_MACHINE\System\CurrentControlSet\control" IF (existkey($ikey) = 0) $user=ReadValue($ikey, "Current User") ENDIF ENDIF IF (len($user) = 0) $user=@userid IF (len($user) = 0) $user="~user" ENDIF ENDIF $x=$x+" "+$user IF (len(@wksta) = 0) $x=$x+" ~wksta" ELSE $x=$x+" "+@wksta ENDIF IF (len(@fullname) = 0) IF (len(@comment) = 0) $x=$x+" ('~fullname')" ELSE $x=$x+" ('~fullname'+'"+@comment+"')" ENDIF ELSE IF (len(@comment) = 0) $x=$x+" ('@fullname')" ELSE $x=$x+" ('"+@fullname+"'+'"+@comment+"')" ENDIF ENDIF $tmp=$x ; IF ($debug_mode = "yes") IF (len(@ipaddress0) = 0) ? "Kixtart "+@kix+" - "+$os+" debug mode (vs "+$prgrm_version+")"+" "+@time+" (off-line)" ELSE ? "Kixtart "+@kix+" - "+$os+" debug mode (vs "+$prgrm_version+")"+" "+@time+" (on-line)" ENDIF ? ? "mode (history) "+$history_mode ? "file (history) "+$history_file ? "mode (dynamic) "+$log_mode ? "file (dynamic) "+$log_file ? "section "+$section ? "key "+$key IF (len(@fullname) = 0) ? "user "+$user ELSE IF (len(@comment) = 0) ? "user "+$user+" ('"+@fullname+"')" ELSE ? "user "+$user+" ('"+@fullname+"'+'"+@comment+"')" ENDIF ENDIF ? IF (INSTR("-4.00-3.63-3.62-3.61-3.60-3.55-",@kix) <> 0) ? "workstation "+@wksta+" ("+LCASE(@lanroot)+")" ELSE ? "workstation "+@wksta+" ("+LCASE(@lanroot)+") C="+GetDiskSpace("c:\")+" KBytes" ENDIF ? "domain "+@domain ? "ldomain "+@ldomain ? " -> = "+$domain ? " "+$ldomain+" (L)" ? "ip_adress "+$ip_new+" "+$address ? ? "debug_mode "+$debug_mode ? "offline_mode "+$offline_mode ? ENDIF ; -------------------------------------------------------------------------- ; - drive-mappings (part 1) - NT/95 - ; -------------------------------------------------------------------------- $mappings="-------------------------- ---" $special_mappings_specified="" $special_printers_specified="" ; $execute_mode="yes" ; -dummy statement- IF ($execute_mode = "yes") $x=$tmp ; ----- HKCU information (part 1) software - NT/95 ----- $ikey="HKEY_CURRENT_USER\Software" ; - NT/95 - IF (existkey($ikey) = 0) $completed="no" $first="" $x=$x+" HKCU.software=(" $index=0 DO $icode=ENUMKEY($ikey, $index) IF (@error = 0) IF ($debug_mode = "yes") ? $ikey+"\"+$icode ENDIF IF (len($icode) <> 0) $x=$x+$first+"["+$icode+"=(" $first="," $completed1="no" $first1="" $index1=0 $ikey1=$ikey+"\"+$icode DO $icode1=ENUMKEY($ikey1, $index1) IF (@error = 0) IF ($debug_mode = "yes") ? " "+$icode1 ENDIF IF (len($icode1) <> 0) $x=$x+$first1+"'"+$icode1+"'" $first1="," ENDIF ELSE $completed1="yes" ENDIF $index1=$index1+1 UNTIL ($completed1 = "yes") $x=$x+")]" ENDIF ELSE $completed="yes" ENDIF $index=$index+1 UNTIL ($completed = "yes") $x=$x+")" ENDIF ; ----- HKCU information (part 2) office - NT/95 ----- $ikey="HKEY_CURRENT_USER\Software\Microsoft\Office" ; - NT/95 - Office 8.0 - IF (existkey($ikey) = 0) $completed="no" $index=0 DO $icode=ENUMKEY($ikey, $index) IF (@error = 0) IF ($debug_mode = "yes") ? $ikey+"\"+$icode ENDIF IF (len($icode) <> 0) $ikey1=$ikey+"\"+$icode IF (existkey($ikey1) = 0) $completed1="no" $first="" $x=$x+" HKCU.office["+$icode+"]=(" $index1=0 DO $icode1=ENUMKEY($ikey1, $index1) IF (@error = 0) IF ($debug_mode = "yes") ? $ikey1+"\"+$icode1 ENDIF IF (len($icode1) <> 0) $x=$x+$first+"'"+$icode1+"'" $first="," ENDIF ELSE $completed1="yes" ENDIF $index1=$index1+1 UNTIL ($completed1 = "yes") $x=$x+")" ENDIF ENDIF ELSE $completed="yes" ENDIF $index=$index+1 UNTIL ($completed = "yes") ENDIF ; ----- HKLM information (part 3) software - NT/95 ----- $ikey="HKEY_LOCAL_MACHINE\Software" ; - NT/95 - ("exc.classes") IF (existkey($ikey) = 0) $completed="no" $first="" $x=$x+" HKLM.software=(" $index=0 DO $icode=ENUMKEY($ikey, $index) IF (@error = 0) IF ($debug_mode = "yes") ? $ikey+"\"+$icode ENDIF IF (len($icode) <> 0) AND (LCASE($icode) <> "classes") $x=$x+$first+"["+$icode+"=(" $first="," $completed1="no" $first1="" $index1=0 $ikey1=$ikey+"\"+$icode DO $icode1=ENUMKEY($ikey1, $index1) IF (@error = 0) IF ($debug_mode = "yes") ? " "+$icode1 ENDIF IF (len($icode1) <> 0) $x=$x+$first1+"'"+$icode1+"'" $first1="," ENDIF ELSE $completed1="yes" ENDIF $index1=$index1+1 UNTIL ($completed1 = "yes") $x=$x+")]" ENDIF ELSE $completed="yes" ENDIF $index=$index+1 UNTIL ($completed = "yes") $x=$x+")" ENDIF IF ($history_mode = "yes") IF ($debug_mode = "yes") ? ? " file = "+UCASE($history_file) ? " key = "+$key ? " x = "+$x ? ENDIF IF (open(9, $history_file, 5) = 0) IF writeline(9, $key+"="+$x+$eol) ENDIF ENDIF IF close(9) ENDIF ENDIF ; IF ($log_mode = "yes") $x=$key+" "+$tmp $key=substr($user+" ",1,20)+$os IF ($debug_mode = "yes") ? ? " file = "+UCASE($log_file) ? " key = "+$user+" "+$os ? " x = "+$x ? ENDIF IF (writeprofilestring($log_file, $os, $key, $x) <> 0) ENDIF ENDIF ENDIF ; -------------------------------------------------------------------------- ; - end - ; -------------------------------------------------------------------------- :end_script $time_stop=@time IF ($NT_mode = "yes") $log_info="Kixtart-info "+$prgrm_version+" script completed successfully" $log_info=$log_info+" for '"+LCASE($user)+"' "+UCASE($domain) $log_info=$log_info+" ("+$time_start+" - "+$time_stop+" - '"+$ip_new+"')" IF (len(@fullname) > 0) $log_info=$log_info+" '"+LCASE(@fullname)+"'" ENDIF ; IF ($debug_mode = "yes") ? ? " logevent = "+$log_info ? ENDIF IF logevent(0, 1, $log_info, "", "Kixtart INFO @kix"+"c") ENDIF ENDIF IF ($debug_mode = "yes") cls IF setconsole("show") ENDIF ? ? "elapse time "+$time_start+" - "+$time_stop ? "completed" ? IF (RedirectOutput("con") = 0) ENDIF ? ? "elapse time "+$time_start+" - "+$time_stop+" (kixtart "+@kix+" vs "+$prgrm_version+") -DEVELOPMENT-" IF ($offline_mode = "yes") ? "completed (off-line)" ELSE ? "completed (on-line)" ENDIF ? ? " -RUN SCRIPT ("+$history_file+" "+$log_file+")-" ENDIF IF (RedirectOutput("con") = 0) ENDIF break on flushkb ; ? IF ($log_mode = "yes") ? "Informative Software.KIX: create dynamic log file '"+$log_file+"'" ELSE ? "Informative Software.KIX: no creation dynamic log file '"+$log_file+"'" ENDIF IF ($history_mode = "yes") ? "Informative Software.KIX: create historical log file '"+$history_file+"'" ELSE ? "Informative Software.KIX: no creation historical log file '"+$history_file+"'" ENDIF IF ($debug_mode = "yes") ? "Informative Software.KIX: create debug list '"+$debug_file+"'" ELSE ? "Informative Software.KIX: no creation of debug list '"+$debug_file+"'" ENDIF