Announcement

Collapse
No announcement yet.

Printing logon script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printing logon script

    HI

    I've just recently changed my setup at work from a workgroup to domain, everything has gone smoothly so far (SBS 2008, mixture of XP and vista desktops)

    Basically I'm looking for a logon script I can map to all my users which when they logon it deletes all the printers they currently have set and adds 5 new ones,

    I hope somebody can help or at least point me in the right direction,

    Thanks,

    Andrew.

  • #2
    Re: Printing logon script

    Well..... you could use a vbscript. Or you could use KixTart.

    Kixtart:
    Here is what you could add in the user's startup script

    Code:
    @echo off
    echo Applying logon settings....Please wait
    
    net use z: \\Server\script_location /persistent:no >null
    
    REM %0\..\kix32.exe %0\..\logon.kix /f
    Z:
    CD\
    kix32.exe logon.kix /f
    
    Z:
    CD\
    sleep 15
    
    C:
    
    net use z: /delete
    
    exit

    Logon.kix

    Code:
    function DelPrinterConnections() 
    dim $c,$bk,$conn 
    $c=0 
    $bk="HKEY_CURRENT_USER\Printers\Connections" 
    $conn=enumkey($bk,$c) 
    while @error=0 
     $c=$c+0.5 
     $conn=delkey($bk+"\"+$conn) 
     $conn=enumkey($bk,$c) 
    loop 
    endfunction
    
    If InGroup("AD_Group1")
    
    use I: /delete
    use I: "\\server\folder_one"
    
    addprinterconnection ("\\Print_Server\\Printer_One")
    addprinterconnection ("\\Print_Server\\Printer_Two")
    setdefaultprinter ("\\Print_Server\\Printer_One")
    
    ENDIF
    
    If InGroup("AD_Group2")
    
    use J: /delete
    use J: "\\server\folder_two"
    
    addprinterconnection ("\\Print_Server\\Printer_Three")
    addprinterconnection ("\\Print_Server\\Printer_Four")
    setdefaultprinter ("\\Print_Server\\Printer_Three")
    
    ENDIF

    Comment


    • #3
      Re: Printing logon script

      There are a lot of printing scripts around in this forum.
      Please use the search functionality to find them.
      Marcel
      Technical Consultant
      Netherlands
      http://www.phetios.com
      http://blog.nessus.nl

      MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
      "No matter how secure, there is always the human factor."

      "Enjoy life today, tomorrow may never come."
      "If you're going through hell, keep going. ~Winston Churchill"

      Comment


      • #4
        Re: Printing logon script

        Was just trying to help....

        Comment


        • #5
          Re: Printing logon script

          oh no, it wasn't to you...
          I meant it to woody09
          Marcel
          Technical Consultant
          Netherlands
          http://www.phetios.com
          http://blog.nessus.nl

          MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
          "No matter how secure, there is always the human factor."

          "Enjoy life today, tomorrow may never come."
          "If you're going through hell, keep going. ~Winston Churchill"

          Comment


          • #6
            Re: Printing logon script

            Originally posted by woody09 View Post
            HI

            I've just recently changed my setup at work from a workgroup to domain, everything has gone smoothly so far (SBS 2008, mixture of XP and vista desktops)

            Basically I'm looking for a logon script I can map to all my users which when they logon it deletes all the printers they currently have set and adds 5 new ones,

            I hope somebody can help or at least point me in the right direction,

            Thanks,

            Andrew.
            cscript %windir%\system32\prnmngr.vbs -ac -p

            Its present in Windows in the path above.

            Comment


            • #7
              Re: Printing logon script

              The path is slightly different to the VBS files for Vista and Windows 7 RC. It's C:\windows\system32\Printing_Admin_Scripts\en-US on those systems.

              I've seen a few articles suggesting copying the VBS files from that location to system32 as part of the logon script, however this will fail if the user is not a local admin. I also had some issues with the switch to set the default printer, what I just do is make sure the printer you want as the default is first in the script. This is the script I use, tested on XP, Vista and 7 RC:-

              IF NOT EXIST "%windir%\System32\Printing_Admin_Scripts\en-US" GOTO :XP
              CSCRIPT %windir%\system32\Printing_Admin_Scripts\en-US\prnmngr.vbs -ac -p "\\server\printer"
              GOTO :END
              :XP

              CSCRIPT %windir%\system32\prnmngr.vbs -ac -p "\\server\printer"

              :END
              Last edited by cruachan; 29th July 2009, 11:25.
              BSc, MCSA: Server 2008, MCSE, MCSA: Messaging, MCTS
              sigpic
              Cruachan's Blog

              Comment

              Working...
              X