; IF setconsole("hide") ; ENDIF ; ; NT/95 mappings - Kixtart 3.63, 4.00 ; ; (c) scripting@wanadoo.nl - 2001 ; ; vs 1.08 - program ; ; 1.00 (20010415) original version (= 4.12) ; 1.01 (20010415) - introduction of subst command ; - collect drives info ; 1.02p (20010415) - don't check local drive "A" ; 1.03p (20010415) - use "HKLM\MountedDevices" by Windows 2000 ; (value are cdrom + removable disks) ; 1.04p (20010701) - minor fix to incorrect substr specification ; - creation of variables about status of drives_type ; - $drive_info_cd ; - $drive_info_local ; - $drive_info_network ; - $drive_info_subst ; 1.05 (20010701) - major fix for check @kix value by local drive part ; (GetDiskSpace) ; 1.06p (20010710) - standardization of $debug_file value ; - minor correction to GetDiskSpace function ; 1.07p (20011115) - minor correction. change '<+' in '<=' ; 1.08p (20011120) - add "windows XP" (input by kdyer) ; - suppress SetConsole("hide") ; ; external programs "net use" + "subst" ; $prgrm_version="1.08" ; $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+"\mappings.log" $log_mode="yes" $log_file=$tmp_directory+"\mappings.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-MAPS "+$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 MAPS @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-",LTRIM(RTRIM(substr(@kix,1,3)))) <> 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="" ; $number_of_drives=26 DIM $drives[$number_of_drives+1] ; - x: - DIM $drives_info[$number_of_drives+1] ; - size/network mapping/subst setting/active.inactive cdrom - DIM $drives_type[$number_of_drives+1] ; - local/cdrom/network/subst - ; $i=1 WHILE ($i <= 26) $drives[$i]="" $drives_info[$i]="" $drives_type[$i]="" $i=$i+1 LOOP ; $execute_mode="yes" ; -dummy statement- IF ($execute_mode = "yes") $x=$tmp+" " IF (exist($tmp_directory+"\kix-net.txt") = 1) shell "%comspec% /e:1024 /c del "+$tmp_directory+"\kix-net.txt" ENDIF IF ($offline_mode <> "yes") shell "%comspec% /e:1024 /c net use >"+$tmp_directory+"\kix-net.txt" IF ($debug_mode = "yes") ? ? " run "+"NET USE command" ENDIF ELSE IF ($debug_mode = "yes") ? ? " -SKIP- "+"no run of NET USE command - OFF-LINE mode" ENDIF ENDIF ;Status Local Remote Network (windows NT) ;OK S: \\server1\mca$ Microsoft Windows Network ;Disconnected F: \\server1.xx.yy.nl\dep_development$ ; Microsoft Windows Network ; M: \\server1\maildata$ NetWare or Compatible Network ;OK O: \\server2\apps Microsoft Windows Network ; Z: \\netw01\prog\apps NetWare or Compatible Network ; \\netw01\dat\maildata NetWare or Compatible Network ; ;Disconnected LPT \\server3\430_HP8000 Microsoft Windows Network ;The command was completed successfully. ;Status Local name Remote name (windows 95) ;OK K: \\server1\MCA$ ;OK L: \\server1\MCA$ ;OK S: \\server1\MCA$ ;OK LPT1 \\server3\HP8000 ;The command was completed successfully. $mappings_remember="no" IF (exist($tmp_directory+"\kix-net.txt") = 1) $x=$x+"(" $completed="yes" $first="" shell "%comspec% /e:1024 /c echo The command completed succesfully >>"+$tmp_directory+"\kix-net.txt" IF ($debug_mode = "yes") ? " read "+"NET USE command output" ENDIF IF (open(1, $tmp_directory+"\kix-net.txt", 3) = 0) $y=readline (1) IF (@error = 0) $completed="no" ENDIF WHILE ($completed <> "yes") IF (@error < 0) $completed="yes" ENDIF IF (INSTR($y,"The command completed succesfully") <> 0) $completed="yes" ENDIF IF (INSTR($y,"New connections will be remembered") <> 0) ; - New connections will be remembered. - $mappings_remember="yes" ELSE ; - New connections will not be remembered. - ENDIF IF ($debug_mode = "yes") IF (len($y) < 10) ? " read "+len($y)+" "+$y ELSE ? " read "+len($y)+" "+$y ENDIF ENDIF IF ($completed <> "yes") IF ($NT_mode = "yes") IF (len($y) > 49) IF (substr($y,15,1) = ":") OR (substr($y,24,2) = "\\") $code="'" IF (substr($y,14,2) = " ") $code=$code+"??" ELSE IF (substr($y,14,3) = "lpt") $code=$code+LCASE(substr($y,14,4)) ELSE $code=$code+LCASE(substr($y,14,2)) ENDIF ENDIF IF (INSTR($y,"Microsoft Windows Network") <> 0) OR (INSTR($y,"NetWare or Compatible Network") <> 0) $code=$code+" "+RTRIM(substr($y,24,26)) ELSE $code=$code+" "+RTRIM(substr($y,24,len($y)-24+1)) ENDIF $code=$code+"'" $x=$x+$first+$code $first="," ; - settings array IF (substr($y,14,3) <> "lpt") $i=INSTR("abcdefghijklmnopqrstuvwxyz",LCASE(substr($code,2,1))) $drives[$i]=LCASE(substr($code,2,2)) IF (INSTR($y,"Microsoft Windows Network") <> 0) OR (INSTR($y,"NetWare or Compatible Network") <> 0) $drives_info[$i]=RTRIM(substr($y,24,26)) ELSE $drives_info[$i]=RTRIM(substr($y,24,len($y)-24+1)) ENDIF $drives_type[$i]="N" ; Network ENDIF ; - check mappings item - $i=INSTR("abcdefghijklmnopqrstuvwxyz",LCASE(substr($code,2,1))) IF (substr($y,14,3) = "lpt") $i=26+INSTR('-123',substr($y,17,1)) IF ($i = 26) $i = 0 ENDIF ENDIF IF ($i <> 0) IF ($i = 1) $mappings=LCASE(substr($code,2,1))+substr($mappings,2,30-1) ELSE IF ($i = 30) $mappings=substr($mappings,1,30-1)+LCASE(substr($code,2,1)) ELSE $mappings=substr($mappings,1,$i-1)+LCASE(substr($code,2,1))+substr($mappings,$i+1,30-$i) ENDIF ENDIF ENDIF ENDIF ENDIF ELSE IF (len($y) > 34) IF (substr($y,18,1) = ":") OR (substr($y,33,2) = "\\") $code="'" IF (substr($y,17,2) = " ") $code=$code+"??" ELSE IF (substr($y,17,3) = "lpt") $code=$code+LCASE(substr($y,17,4)) ELSE $code=$code+LCASE(substr($y,17,2)) ENDIF ENDIF $code=$code+" "+RTRIM(substr($y,33,len($y)-33+1))+"'" $x=$x+$first+$code $first="," ; - settings array IF (substr($y,17,3) <> "lpt") $i=INSTR("abcdefghijklmnopqrstuvwxyz",LCASE(substr($code,2,1))) $drives[$i]=LCASE(substr($code,2,2)) $drives_info[$i]=RTRIM(substr($y,33,len($y)-33+1)) $drives_type[$i]="N" ; Network ENDIF ; - check mappings item - $i=INSTR("abcdefghijklmnopqrstuvwxyz",LCASE(substr($code,2,1))) IF (substr($y,17,3) = "lpt") $i=26+INSTR('-123',substr($y,20,1)) IF ($i = 26) $i = 0 ENDIF ENDIF IF ($i <> 0) IF ($i = 1) $mappings=LCASE(substr($code,2,1))+substr($mappings,2,30-1) ELSE IF ($i = 30) $mappings=substr($mappings,1,30-1)+LCASE(substr($code,2,1)) ELSE $mappings=substr($mappings,1,$i-1)+LCASE(substr($code,2,1))+substr($mappings,$i+1,30-$i) ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF IF ($completed <> "yes") $y=readline (1) ENDIF LOOP IF close (1) ENDIF ENDIF $x=$x+")" IF ($mappings_remember = "yes") $x=$x+" remember.MAP" ELSE $x=$x+" no.MAP.remember" ENDIF ENDIF IF ($debug_mode = "yes") ? ENDIF ; ----- drive-mappings (part 2a) - NT ----- $ikey="HKEY_CURRENT_USER\Network" ; - NT - IF (existkey($ikey) = 0) AND ($NT_mode = "yes") $completed="no" $first="" $x=$x+" HKCU.network[NT]=(" $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+"=(" $x=$x+"RemotePath='" +ReadValue($ikey+"\"+$icode, "RemotePath")+"', " $x=$x+"UserName='" +ReadValue($ikey+"\"+$icode, "UserName")+"', " $x=$x+"ConnectionType='"+ReadValue($ikey+"\"+$icode, "ConnectionType")+"'" $first=")]," ; IF (len($icode) = 1) $special_mappings_specified=$special_mappings_specified+LCASE(substr($icode,1,1)) ELSE IF (INSTR(LCASE($icode),"lpt") <> 0) IF (len($icode) = 4) $special_printers_specified=$special_printers_specified+substr($icode,4,1) ENDIF ENDIF ENDIF ENDIF ELSE $completed="yes" ENDIF $index=$index+1 UNTIL ($completed = "yes") IF ($first = "") $x=$x+")" ELSE $x=$x+")])" ENDIF ENDIF ; ----- drive-mappings (part 2b) - 95 (recent/persistent) ----- $ikey="HKEY_CURRENT_USER\Network\Recent" ; - 95 - $ikey="-skip-key-" ; - unwanted information - IF (existkey($ikey) = 0) AND ($NT_mode <> "yes") $completed="no" $first="" $x=$x+" HKCU.network.recent[95]=(" $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+"=(" IF (existkey($ikey+"\"+$icode+"\"+"RemotePath") = 0) $x=$x+"RemotePath='" +ReadValue($ikey+"\"+$icode, "RemotePath")+"', " $x=$x+"UserName='" +ReadValue($ikey+"\"+$icode, "UserName")+"', " $x=$x+"ConnectionType='"+ReadValue($ikey+"\"+$icode, "ConnectionType")+"'" ENDIF $first=")]," ENDIF ELSE $completed="yes" ENDIF $index=$index+1 UNTIL ($completed = "yes") IF ($first = "") $x=$x+")" ELSE $x=$x+")])" ENDIF ENDIF ; - drive-mappings 95 (persistent) - $ikey="HKEY_CURRENT_USER\Network\Persistent" ; - 95 - IF (existkey($ikey) = 0) $completed="no" $first="" $x=$x+" HKCU.network.persistent[95]=(" $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+"=(" IF (existkey($ikey+"\"+$icode+"\"+"RemotePath") = 0) $x=$x+"RemotePath='" +ReadValue($ikey+"\"+$icode, "RemotePath")+"', " $x=$x+"UserName='" +ReadValue($ikey+"\"+$icode, "UserName")+"', " $x=$x+"ConnectionType='"+ReadValue($ikey+"\"+$icode, "ConnectionType")+"'" ENDIF $first=")]," ; ENDIF ELSE $completed="yes" ENDIF $index=$index+1 UNTIL ($completed = "yes") IF ($first = "") $x=$x+")" ELSE $x=$x+")])" ENDIF ENDIF ; ----- HKLM hardware configuration (part 3a) - local hardware cdrom - 95 ----- $fix_disk="" $fix_cdrom="" ; - CDrom active ? - W95: IDE / remark: disk-drives only locatable by HKCC registry. not readable by kixtart - IF ($NT_mode <> "yes") $ikey="HKEY_LOCAL_MACHINE\Enum\SCSI" ; - 95 - IF (ExistKey($ikey) = 0) $completed="no" $index=0 DO $icode=ENUMKEY($ikey, $index) IF (@error = 0) IF (len($icode) <> 0) $completed1="no" $index1=0 $ikey1=$ikey+"\"+$icode DO $icode1=ENUMKEY($ikey1, $index1) IF (@error = 0) $ikey2=$ikey1+"\"+$icode1 $icode2=ReadValue($ikey2, "Class") IF (@error = 0) ENDIF IF (len($icode2) <> 0) IF (LCASE($icode2) = "cdrom") $fix_cdrom=$fix_cdrom+ReadValue($ikey2, "CurrentDriveLetterAssignment") ENDIF ENDIF ELSE $completed1="yes" ENDIF $index1=$index1+1 UNTIL ($completed1 = "yes") ENDIF ELSE $completed="yes" ENDIF $index=$index+1 UNTIL ($completed = "yes") ENDIF ENDIF ; ----- HKLM services configuration (part 3b) - cdrom - NT ----- ; - CDrom active ? - NT: IDE / remark: disk-drives only locatable by HKCC registry. not readable by kixtart - IF ($NT_mode = "yes") $ikey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_CDROM\0000\Control" IF (ExistKey($ikey) = 0) ; - NT - $ivalue=ReadValue($ikey, "ActiveService") IF (@error = 0) ; $ikey="HKEY_LOCAL_MACHINE\SYSTEM\DISK" IF (ExistKey($ikey) = 0) $ivalue=ReadValue($ikey, "\Device\CdRom0") IF (@error = 0) $fix_cdrom=LCASE(substr($ivalue,1,1)) ENDIF ENDIF ENDIF ENDIF ; $ikey="HKEY_LOCAL_MACHINE\System\MountedDevices" IF (ExistKey($ikey) = 0) ; - NT - $i=3 ; - range "c".."z" WHILE ($i <= 26) $i_drive=substr("abcdefghijklmnopqrstuvwxyz",$i,1)+":" $ivalue=ReadValue($ikey, "\DosDevices\"+$i_drive) IF (@error = 0) $i_space=0 $i_space=GetDiskSpace($i_drive) IF ($i_space = 0) $fix_cdrom=$fix_cdrom+LCASE($i_drive) ENDIF ENDIF $i=$i+1 LOOP ENDIF ENDIF ; $fix_cdrom=LCASE($fix_cdrom) IF (len($fix_cdrom) <> 0) ? " cdrom=("+$fix_cdrom+")" ELSE ? " cdrom=(?)" ENDIF ; ----- local drives - subst (part 4a) ----- ; - check local drives set by SUBST command - IF (exist($tmp_directory+"\kix-subst.txt") = 1) shell "%comspec% /e:1024 /c del "+$tmp_directory+"\kix-subst.txt" ENDIF shell "%comspec% /e:1024 /c subst >"+$tmp_directory+"\kix-subst.txt" IF ($debug_mode = "yes") ? ? " run "+"SUBST command" ENDIF IF (exist($tmp_directory+"\kix-subst.txt") = 1) $x=$x+" subst=(" $completed="yes" $first="" shell "%comspec% /e:1024 /c echo subst completed succesfully >>"+$tmp_directory+"\kix-subst.txt" IF ($debug_mode = "yes") ? " read "+"SUBST command output" ENDIF IF (open(1, $tmp_directory+"\kix-subst.txt", 3) = 0) $y=readline (1) IF (@error = 0) $completed="no" ENDIF WHILE ($completed <> "yes") IF (@error < 0) $completed="yes" ENDIF IF (INSTR($y,"subst completed succesfully") <> 0) $completed="yes" ENDIF IF ($debug_mode = "yes") IF (len($y) < 10) ? " read "+len($y)+" "+$y ELSE ? " read "+len($y)+" "+$y ENDIF ENDIF IF ($completed <> "yes") IF (len($y) > 4) $i=INSTR("abcdefghijklmnopqrstuvwxyz",LCASE(substr($y,1,1))) IF ($i <> 0) $code="'" $code=$code+LCASE(substr($y,1,1))+":" $code=$code+" "+LCASE(substr($y,INSTR($y,">")+2,len($y)-INSTR($y,">")-2+1)) $code=$code+"'" ; $x=$x+$first+$code $first="," ; $drives[$i]=LCASE(substr($y,1,1))+":" $drives_info[$i]=LCASE(substr($y,INSTR($y,">")+2,len($y)-INSTR($y,">")-2+1)) $drives_type[$i]="Subst" ; IF ($i = 1) $mappings=UCASE(substr($y,1,1))+substr($mappings,2,30-1) ELSE IF ($i = 30) $mappings=substr($mappings,1,30-1)+UCASE(substr($y,1,1)) ELSE $mappings=substr($mappings,1,$i-1)+UCASE(substr($y,1,1))+substr($mappings,$i+1,30-$i) ENDIF ENDIF ENDIF ENDIF ENDIF IF ($completed <> "yes") $y=readline (1) ENDIF LOOP IF close (1) ENDIF ENDIF $x=$x+")" ENDIF ; ----- local drives (part 4b) ----- ; - check local drives. available drives will be marked with a "*" symbol - IF ($debug_mode = "yes") ? ? " local drives (cdrom, fixed, removable)" ? ENDIF ; - local drives - fixed/removable - $index=3 ; - range "C".."Z" WHILE ($index <= 26) AND (INSTR("-4.00-3.63-3.62-3.61-3.60-3.55-",LTRIM(RTRIM(substr(@kix,1,3)))) <> 0) $i=substr("abcdefghijklmnopqrstuvwxyz",$index,1) IF (INSTR(LCASE($mappings), $i) = 0) $i_drive=$i+":\" $i_space=0 IF (Exist($i_drive+"\nul") = 1) OR (Exist($i_drive) = 1) $i_space=GetDiskSpace($i_drive) IF ($index = 1) $mappings=UCASE($i)+substr($mappings,2,30-1) ELSE IF ($index = 30) $mappings=substr($mappings,1,30-1)+UCASE($i) ELSE $mappings=substr($mappings,1,$index-1)+UCASE($i)+substr($mappings,$index+1,30-$index) ENDIF ENDIF ; $drives[$index]=LCASE($i_drive) $drives_info[$index]=substr(" ",1,10-len("$i_space"))+$i_space $drives_type[$index]="L" ; Local Drive ; IF ($debug_mode = "yes") ? " "+$i_drive+" -> "+$i_space+" KBytes" ENDIF $x=$x+" diskspace."+UCASE($i)+"=("+GetDiskSpace($i_drive)+" KBytes)" ENDIF ENDIF $index=$index+1 LOOP ; - cdrom drive - $index=1 WHILE ($index <= len($fix_cdrom)) IF (INSTR("abcdefghijklmnopqrstuvwxyz",substr($fix_cdrom,$index,1)) <> 0) $i=INSTR("abcdefghijklmnopqrstuvwxyz",substr($fix_cdrom,$index,1)) IF ($i = 1) $mappings=UCASE(substr($fix_cdrom,$index,1))+substr($mappings,2,30-1) ELSE IF ($i = 30) $mappings=substr($mappings,1,30-1)+UCASE(substr($fix_cdrom,$index,1)) ELSE $mappings=substr($mappings,1,$i-1)+UCASE(substr($fix_cdrom,$index,1))+substr($mappings,$i+1,30-$i) ENDIF ENDIF ; $drives[$i]=LCASE(substr($fix_cdrom,$index,1)+":") IF (len(LTRIM(RTRIM($drives_info[$i]))) <> 0) $drives_info[$i]=" active" ELSE $drives_info[$i]=" inactive" ENDIF $drives_type[$i]="CD" ; CD ENDIF $index=$index+1 LOOP $x=$x+" diskspace.cdrom=("+LCASE($fix_cdrom)+")" IF ($debug_mode = "yes") ? ENDIF ; ----- check special mappings (part 5) ----- ; - check mappings items for special mappings. available drives will be marked in UCASE character - $index=1 WHILE ($index <= len($special_mappings_specified)) $i=INSTR("abcdefghijklmnopqrstuvwxyz",LCASE(substr($special_mappings_specified,$index,1))) IF ($i <> 0) IF ($i = 1) $mappings=UCASE(substr($special_mappings_specified,$index,1))+substr($mappings,2,30-1) ELSE IF ($i = 30) $mappings=substr($mappings,1,30-1)+UCASE(substr($special_mappings_specified,$index,1)) ELSE $mappings=substr($mappings,1,$i-1)+UCASE(substr($special_mappings_specified,$index,1))+substr($mappings,$i+1,30-$i) ENDIF ENDIF ENDIF $index=$index+1 LOOP ; - check mappings items for special printers. available printer will be marked with "*" symbol - $index=1 WHILE ($index <= len($special_printers_specified)) $i=INSTR("---------------------------123",LCASE(substr($special_printers_specified,$index,1))) IF ($i <> 0) IF ($i = 1) $mappings="*"+substr($mappings,2,30-1) ELSE IF ($i = 30) $mappings=substr($mappings,1,30-1)+"*" ELSE $mappings=substr($mappings,1,$i-1)+"*"+substr($mappings,$i+1,30-$i) ENDIF ENDIF ENDIF $index=$index+1 LOOP ; IF (len($mappings) = 0) OR ($mappings = "-------------------------- ---") $x=$x+" no.mappings" IF ($mappings_remember = "yes") $x=$x+" remember.MAP" ELSE $x=$x+" no.MAP.remember" ENDIF ELSE $x=$x+" mappings='"+$mappings IF ($mappings_remember = "yes") $x=$x+" yes" ELSE $x=$x+" no" ENDIF $x=$x+"'" ENDIF IF (exist($tmp_directory+"\kix-net.txt") = 1) IF ($debug_mode <> "yes") run "%comspec% /e:1024 /c del "+$tmp_directory+"\kix-net.txt" ENDIF ; IF ($debug_mode = "yes") ? " -SKIP- "+"del "+$tmp_directory+"\kix-net.txt" ENDIF ENDIF IF (exist($tmp_directory+"\kix-subst.txt") = 1) IF ($debug_mode <> "yes") run "%comspec% /e:1024 /c del "+$tmp_directory+"\kix-subst.txt" ENDIF ; IF ($debug_mode = "yes") ? " -SKIP- "+"del "+$tmp_directory+"\kix-subst.txt" ENDIF 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") $key=substr($user+" ",1,20)+$os $x=$key+" "+$mappings IF ($mappings_remember = "yes") $x=$x+" yes" ELSE $x=$x+" no" ENDIF IF (len($special_mappings_specified) <> 0) $x=$x+" persistent.map=("+$special_mappings_specified+")" ENDIF IF (len($special_printers_specified) <> 0) $x=$x+" persistent.lpt=("+$special_printers_specified+")" ENDIF IF ($debug_mode = "yes") ? ? " file = "+UCASE($log_file) ? " key = "+$user+" "+$os ? " x = "+$mappings ? ENDIF IF (writeprofilestring($log_file, $os, $key, $x) <> 0) ENDIF ENDIF ? ? " summary mappings" ? $i=1 WHILE ($i <= 26) IF ($drives[$i] <> "") ? $drives[$i]+" "+substr($drives_type[$i]+" ",1,5)+" "+$drives_info[$i] ENDIF $i=$i+1 LOOP ? IF ($mappings_remember = "yes") ? "mappings: "+$mappings+" yes" ELSE ? "mappings: "+$mappings+" no" ENDIF ENDIF ; -------------------------------------------------------------------------- ; - end - ; -------------------------------------------------------------------------- :end_script $time_stop=@time IF ($NT_mode = "yes") $log_info="Kixtart-MAPS "+$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 MAPS @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 ; ? ? " summary mappings" ? $i=1 WHILE ($i <= 26) IF ($drives[$i] <> "") ? $drives[$i]+" "+substr($drives_type[$i]+" ",1,5)+" "+$drives_info[$i] ENDIF $i=$i+1 LOOP ? IF ($mappings_remember = "yes") ? "mappings: "+$mappings+" yes" ELSE ? "mappings: "+$mappings+" no" ENDIF ? IF ($log_mode = "yes") ? "Informative Mappings.KIX: create dynamic log file '"+$log_file+"'" ELSE ? "Informative Mappings.KIX: no creation dynamic log file '"+$log_file+"'" ENDIF IF ($history_mode = "yes") ? "Informative Mappings.KIX: create historical log file '"+$history_file+"'" ELSE ? "Informative Mappings.KIX: no creation historical log file '"+$history_file+"'" ENDIF IF ($debug_mode = "yes") ? "Informative Mappings.KIX: create debug list '"+$debug_file+"'" ELSE ? "Informative Mappings.KIX: no creation of debug list '"+$debug_file+"'" ENDIF ; $drive_info_cd="" $drive_info_local="" $drive_info_network="" $drive_info_subst="" $i=1 WHILE ($i <= 26) IF ($drives[$i] <> "") IF (LCASE($drives_type[$i]) = 'cd') $drive_info_cd=$drive_info_cd+Substr($drives[$i],1,1) ENDIF IF (LCASE($drives_type[$i]) = 'l') $drive_info_local=$drive_info_local+Substr($drives[$i],1,1) ENDIF IF (LCASE($drives_type[$i]) = 'n') $drive_info_network=$drive_info_network+Substr($drives[$i],1,1) ENDIF IF (LCASE($drives_type[$i]) = 'subst') $drive_info_subst=$drive_info_subst+Substr($drives[$i],1,1) ENDIF ENDIF $i=$i+1 LOOP ? ; ? "$$drive_info_cd "+$drive_info_cd ; ? "$$drive_info_local "+$drive_info_local ; ? "$$drive_info_network "+$drive_info_network ; ? "$$drive_info_subst "+$drive_info_subst