Set the default printer for a terminal server session

Discussion in 'Scripting' started by Andrea Caldarone, Dec 29, 2009.

  1. Hi all,

    I've one user, let's say "user_one" who is granted to access to a terminal
    server "ts01", on this terminal server is installed for that user a printer
    (shared on a third machine):

    user_one is the user who logons
    ts01 is the terminal server (Windows 2008)
    pc01 is the pc on wich is shared the printer
    hp101 is the printer name

    I'm searching for a script that set \\pc01\hp101 as the default printer for
    user_one, I'me trying the following:

    Set WshNetwork = WScript.CreateObject("WScript.Network")
    PrinterPath = "\\pc01\hp101"
    WshNetwork.AddWindowsPrinterConnection PrinterPath
    WshNetwork.SetDefaultPrinter PrinterPath
    WScript.Quit

    but the script does nothing
     
    Andrea Caldarone, Dec 29, 2009
    #1
    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.