I'm using Kixtart v 4.60 to map the user's DFS network shares, and shared network printers off of a Windows 2003 Server.

**The issue is that when the user logs in, the script moves the default printer setting from what they set previously to one of the network printers that they received as a result of their group Active Directory membership.

I'm looking for the Script to do the following:

Upon logon - Check the default Setting of a Local Printer - Save it to memory.

Map all available network printers according to their group but do not set the default printer to any shared network printer if a local one has already been defined previously.

Here is what I have currently

 Code:

Using Kixtart v 4.60.0.0

;DFS Network Drive Mappings

         If InGroup("Domain Users")
            Use * /delete /persistent
            Use z: "\\domain.local\Shared$\Users\%username%" /persistent
         EndIf

         If InGroup("Executive")
            Use j: "\\domain.local\Shared$\Executive" /persistent
         EndIf
        
         If InGroup("Operations") 
            Use k: "\\domain.local\Shared$\Operations" /persistent
         EndIf
         
        If InGroup("Finance") 
            Use l: "\\domain.local\Shared$\Finance" /persistent
        EndIf
        
        If InGroup("Technology") 
            Use m: "\\domain.local\Shared$\Technology" /persistent
        EndIf
        
        If InGroup("Sales") 
            Use n: "\\domain.local\Shared$\Sales" /persistent
        EndIf
        
        If InGroup("Editorial")
            Use o: "\\domain.local\Shared$\Editorial" /persistent
        EndIf
        
        If InGroup("Marketing") 
            Use p: "\\domain.local\Shared$\Marketing" /persistent
        EndIf

:Exit


;Delete all Network Printers Only -- Local Printers will not be deleted

$key = "HKEY_CURRENT_USER\Printers\Connections"
$printers = ArrayEnumKey($key)
For Each $printer in $printers
	$rc = DelKey($key + "\" + $printer)
Next

Function arrayenumkey($regsubkey)
  Dim $retcode, $subkeycounter, $currentsubkey, $subkeyarray

  If Not KeyExist($regsubkey)
    Exit 87
  EndIf

  $subkeycounter=0
  Do
    $currentsubkey=EnumKey($regsubkey,$subkeycounter)
    If Not @ERROR
      ReDim preserve $subkeyarray[$subkeycounter]
      $subkeyarray[$subkeycounter]=$currentsubkey
      $subkeycounter=$subkeycounter+1
    EndIf
  Until @ERROR

  $arrayenumkey=$subkeyarray
  Exit 0
EndFunction



:Exit





;Map and Set Printer per Room #






        If InGroup("P1005") = 1 "Mapping Network Printers"
           
           addprinterconnection("\\dc01\Printer 1005")
           setDefaultPrinter("\\dc01\Printer 1005")
        
        EndIf


        If InGroup("P1013") = 1 "Mapping Network Printers"
           
           addprinterconnection("\\dc01\Printer 1013")
           setDefaultPrinter("\\dc01\Printer 1013")
        
        
        EndIf        

        If InGroup("P1021") = 1 "Mapping Network Printers"
             
             addprinterconnection("\\dc01\Printer 1021")
             setDefaultPrinter("\\dc01\Printer 1021")
        
        EndIf

        
        If InGroup("P1029") = 1 "Mapping Network Printers"
             
             addprinterconnection("\\dc01\Printer 1029")            
             setDefaultPrinter("\\dc01\Printer 1029")    
            
        EndIf

        If InGroup("P1031") = 1 "Mapping Network Printers"
             
             addprinterconnection("\\dc01\Printer 1031")
             SetDefaultPrinter("\\dc01\Printer 1031")
        
        EndIf

:Exit

; All Printers for all rooms 


        If InGroup("All Printers") = 1 "Mapping Network Printers"
            addprinterconnection("\\dc01\Printer 1005")
            addprinterconnection("\\dc01\Printer 1013")
            addprinterconnection("\\dc01\Printer 1021")
            addprinterconnection("\\dc01\Printer 1029")
            addprinterconnection("\\dc01\Printer 1031")
        EndIf
:Exit


        



Thanks in advance.



Edited by sryan (2009-10-20 02:55 AM)
Edit Reason: I had 2.60 for my version of kixtart when it should have been 4.60