; IF setconsole("hide") ; ENDIF ; ; NT/95 creation of environment variables - Kixtart 3.63, 4.00 ; ; (c) scripting@wanadoo.nl - 1999, 2000, 2001 ; ; vs 3.04 - program ; ; 1.00 (19990301) original version. ; 3.00 (20010330) last update (= 4.12) ; 3.01 (20010401) - kixtart 2001 beta1 compliancy ; - add user information about output generation ; 3.02 (20010701) - using %tmp% value ; - remove play command ; 3.03 (20010710) - standardization of $debug_file value ; 3.04 (20011120) - add "windows XP" ; - suppress SetConsole("hide") ; - include also kixtart 4.00 macro's: csd, productsuite, producttype ; ; special variables: $user, ; $debug_mode, ; $NT_mode, ; $time_start, $time_stop ; other variables: $domain, $ldomain ; temporary variables: $ikey, $icode, $ivalue ; $prgrm_version="3.04" ; $time_start=@time $time_stop=@time ; $tmp_directory=ExpandEnvironmentVars("%tmp%") IF (substr($tmp_directory,len($tmp_directory),1) <> "\") $tmp_directory=$tmp_directory+"\" ENDIF ; MD $tmp_directory IF (@error = 0) ENDIF ; --------------------------------------------------------------------------- ; - site defined settings - ; --------------------------------------------------------------------------- $debug_mode="yes" ; - no/yes - $debug_file=$tmp_directory+"kix-info.log" $batch_file=$tmp_directory+"kix-set.bat" ; --------------------------------------------------------------------------- ; - - ; --------------------------------------------------------------------------- IF (@inwin = 1) $NT_mode="yes" ELSE $NT_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 $tmp_directory 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-SET "+$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 SET @kix") ENDIF ENDIF ; IF setconsole("hide") ENDIF ; -------------------------------------------------------------------------- ; - special variables settings - ; -------------------------------------------------------------------------- IF (len(@ipaddress0) <> 0) IF (len(@lserver) = 0) $lserver="~lserver " ELSE $lserver=@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 IF (len(@address) = 0) $address="xxxxxxxxxxxx" ELSE $address=@address ENDIF $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 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 ? IF (len(@fullname) = 0) ? "user "+$user ELSE IF (len(@comment) = 0) ? "user "+$user+" ('"+@fullname+"')" ELSE ? "user "+$user+" ('"+@fullname+"'+'"+@comment+"')" ENDIF ENDIF ? ? "workstation "+@wksta+" ("+LCASE(@lanroot)+") C="+GetDiskSpace("c:\")+" KBytes" ? "domain "+@domain ? "ldomain "+@ldomain ? " -> = "+$domain ? " "+$ldomain+" (L)" ? "ip_adress "+$ip_new+" "+$address ? ? " key settings"+" -> "+$batch_file ? ? "debug_mode "+$debug_mode ? ENDIF ; -------------------------------------------------------------------------- ; - setting environment variables: $batch_file used by kixcheck.exe - ; -------------------------------------------------------------------------- $cr=CHR(10) $lf=CHR(13) $eol=$lf+$cr ; IF (exist($batch_file) = 1) shell "%comspec% /e:1024 /c del "+$batch_file ENDIF IF (open(9, $batch_file, 5) = 0) IF writeline(9, CHR(64)+"echo off"+$eol) ENDIF IF writeline(9, " set username="+$user+$eol) ENDIF IF (len(@homedrive) <> 0) IF writeline(9, " set homedrive="+@homedrive+$eol) ENDIF ENDIF IF writeline(9, " set ip="+$ip_new+$eol) ENDIF IF writeline(9, " set mac="+$address+$eol) ENDIF IF writeline(9, " set os="+$os+$eol) ENDIF IF (len(@scriptdir) <> 0) IF writeline(9, " set scriptdir="+@scriptdir+$eol) ENDIF ENDIF IF (len(@startdir) <> 0) IF writeline(9, " set startdir="+@startdir+$eol) ENDIF ENDIF IF (len(@fullname) = 0) IF (len(@comment) = 0) IF writeline(9, " set user="+$user+" ('~fullname')"+$eol) ENDIF ELSE IF writeline(9, " set user="+$user+" ('~fullname'+'"+@comment+"')"+$eol) ENDIF ENDIF ELSE IF (len(@comment) = 0) IF writeline(9, " set user="+$user+" ('"+@fullname+"')"+$eol) ENDIF ELSE IF writeline(9, " set user="+$user+" ('"+@fullname+"'+'"+@comment+"')"+$eol) ENDIF ENDIF ENDIF IF writeline(9, " set computername="+@wksta+$eol) ENDIF IF writeline(9, " set homepath="+@homedir+$eol) ENDIF IF writeline(9, " set homeshare="+@homeshr+$eol) ENDIF IF writeline(9, " set kix="+@kix+$eol) ENDIF IF writeline(9, " set logondomain="+@ldomain+$eol) ENDIF IF writeline(9, " set logondrive="+@ldrive+$eol) ENDIF IF writeline(9, " set logonserver="+@lserver+$eol) ENDIF IF writeline(9, " set remoteserver="+@rserver+$eol) ENDIF IF writeline(9, " set userdomain="+$domain+$eol) ENDIF ; IF writeline(9, " set username="+$user+$eol) ; ENDIF IF (Instr("-4.00-",substr(@kix,1,1)) <> 0) IF writeline(9, " set csd="+LCASE(LTRIM(RTRIM(@csd)))+$eol) ENDIF IF writeline(9, " set productsuite="+@productsuite+$eol) ENDIF IF writeline(9, " set producttype="+@producttype+$eol) ENDIF ENDIF IF writeline(9, CHR(64)+"echo off"+$eol) ENDIF IF close(9) ENDIF IF ($debug_mode = "yes") ? ? " -SKIP- "+"call "+$batch_file+" (run outside KIXTART procedure)" ? ENDIF ENDIF ; -------------------------------------------------------------------------- ; - end - ; -------------------------------------------------------------------------- :end_script $time_stop=@time IF ($NT_mode = "yes") $log_info="Kixtart-SET "+$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 SET @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 ? IF ($debug_mode = "yes") ? "elapse time "+$time_start+" - "+$time_stop+" (kixtart "+@kix+" vs "+$prgrm_version+") -DEVELOPMENT-" ELSE ? "elapse time "+$time_start+" - "+$time_stop+" (kixtart "+@kix+" vs "+$prgrm_version+")" ENDIF ? "completed" ? ? " -RUN SCRIPT ("+$batch_file+")-" ? ENDIF IF ($debug_mode <> "yes") IF (exist($debug_file) = 1) del $debug_file ENDIF ENDIF ; IF (RedirectOutput("CON",1) = 0) ENDIF color C+/N ? "Informative SetEnv.KIX: create batch file '"+$batch_file+"'" IF ($debug_mode = "yes") ? "Informative SetEnv.KIX: create debug list '"+$debug_file+"'" ELSE ? "Informative SetEnv.KIX: no creation of debug list '"+$debug_file+"'" ENDIF break on flushkb