Logon Script to change network printers from one server to another

Posted on 2005-05-16
Last Modified: 2010-04-12
I’m looking to create a logon script in an environment of Win2k and XP Pro on a Windows 2000 domain for changing the server hosting the network share of a printer.  In a small office of 15 users I have a Windows 2000 server sharing the 3 printers in that site.  The 15 users either have one, both, or all three printers in their local profiles with the default printer being different from person to person too.

I’m replacing the existing Win2k server with a new one and would like to change the printers on each client machine without going from computer to computer.  The shared names of the printers on the new server are the same as the old.  How can I create a script to change the server?  The script could be a vbs, wsh, or a batch file; it doesn’t matter to me.

User1 on Computer1 has a connection to \\OldServer\Printer1 and \\OldServer\Printer3 under her profile with Printer3 as the default.  

User2 on Computer2 has a connection to \\OldServer\Printer2 and \\OldServer\Printer3 under his profile with Printer2 as the default.  

The ideal script would simply rename \\OldServer to \\NewServer in both scenarios without changing the default printer and without adding a printer they didn’t connect to before.  
Question by:gndcdosps
    LVL 5

    Expert Comment

    Just out of interest, if you're replacing the old server and taking it off the network, why can't the new server be named identically?
    LVL 9

    Accepted Solution

    Set WshNetwork = WScript.CreateObject("WScript.Network")
    PrinterPath = "\\printserv\DefaultPrinter"
    WshNetwork.AddWindowsPrinterConnection PrinterPath
    LVL 9

    Expert Comment

    These are VBScript. Respond back if you need help on creating logon scripts.

    Add the last line to set as the default printer

    Set WshNetwork = WScript.CreateObject("WScript.Network")
    PrinterPath = \\printserv\DefaultPrinter"
    WshNetwork.AddWindowsPrinterConnection PrinterPath
    WshNetwork.SetDefaultPrinter PrinterPath

    printserv = your server name
    DefaultPrinter= your printer share name
    LVL 6

    Expert Comment

    seek for "printui.dll,PrintUIEntry" on

    or type
    rundll32 printui.dll,PrintUIEntry /?
    LVL 6

    Expert Comment

    at cmd
    LVL 37

    Expert Comment

    No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
    I will leave a recommendation in the Cleanup topic area that this question is:
    Accept jonoakley
    Any objections should be posted here in the next 4 days. After that time, the question will be closed.


    EE Cleanup Volunteer

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Join & Write a Comment

    This seems to be a very common error related to the Samsung printer driver. First, this is the error we're talking about: Log: System Type: Error Event: 7000 Agent Time: 3:37:24 am 22-Apr-09 Event Time: 6:07:24 pm 21-Apr-09 UTC Source: Se…
    Printers have changed substantially in the last 30 or so years, not just in technical capabilities but in cost and usage as well.  Printers were originally used for interfacing with the operator, not necessarily for printing copy or pictures. In …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now