Terminal users default printer not staying desfault.

Discussion in 'Scripting' started by saveoncomputers, Aug 2, 2008.

  1. I use terminial servers with network printers. All users can use any printer
    but they set their own default printer. The default printer is lost when they
    log off.
    On 2003 server, I created the logon and logoff script below:

    Logon Script:
    REG IMPORT \\server\DefaultPrinters\%clientname%.reg

    Logoff Script:

    DEL \\server\DefaultPrinters\%clientname%.reg /q

    reg export "HKCU\Software\Microsoft\Windows NT\Currentversion\Windows"

    This works great in 2003 but in 2008, the %clientname% variable is not
    created while the logon scripte is run. And, it dissappears before the logoff
    scrip is started.

    IN 2008 I put the logon script in the Startup so it runs and gets the
    %clientnamen% correctly but I don't know how to run a logoff script before
    the %clientname% dissappears...

    How do I retain the default printer set by the user from one terminal
    session to the next.
    Does anyone have a way to perform this function in 2008 or another way to
    achieve this goal?

    saveoncomputers, Aug 2, 2008
    1. Advertisements

  2. It was a pain in the @#$ but I found a workaround. This works for 2008

    Logon Script:
    REM The following lines create a batch file to be run at logoff that will
    create a reg file to be imported at next logon.
    md \\server\defaultprinter\%username%
    REG IMPORT \\server\defaultprinter\%clientNAME%.reg
    echo REG export "HKCU\Software\Microsoft\Windows NT\Currentversion\Windows"
    \\server\defaultprinter\%clientNAME%.reg >
    \\server\defaultprinter\%userNAME%\defaultPrinter.cmd /Y

    Logoff Script:
    REM Call the batch file that was created during logon.
    call \\server\defaultprinter\%userNAME%\defaultPrinter.cmd

    saveoncomputers, Aug 3, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.