Script to delete, add network printer

Posted on 2011-05-11
Last Modified: 2012-05-11
I'm having a heck of a time getting a proper script to delete/remove then add a printer to a Windows 7 Starter client.

We have a network printer located at: \\blue\C351_PCL that's shared through a Win2k3 server.  It will require credentials... We'll say user: printer  password: printer.

Can someone help/provide me a script that will remove this existing printer then reinstall it?  I can't seem to get the PC to remember credentials... so every morning I have to manually do this.  I would put the machine on the domain but it's Win7 starter...
Question by:gr1z

    Accepted Solution

    Ok figured it out.

    Remove: @Rundll32.exe printui.dll,PrintUIEntry /dn /q /n"\\blue\C451_PCL

    Add: @Rundll32.exe printui.dll,PrintUIEntry /in /q /n"\\blue\C451_PCL


    Author Closing Comment

    Figured it out.
    LVL 10

    Expert Comment

    by:Tyler Laczko
    Set WshNetwork = CreateObject("WScript.Network")
    WshNetwork.AddWindowsPrinterConnection "\\server\Xerox WorkCentre Pro C3545"
    WshNetwork.AddWindowsPrinterConnection "\\server\Xerox WorkCentre Pro C3545 - Color"
    WshNetwork.AddWindowsPrinterConnection "\\server\Xerox WorkCentre 7435"
    WshNetwork.AddWindowsPrinterConnection "\\server\Xerox WorkCentre 7435 - Color"
    WshNetwork.AddWindowsPrinterConnection "\\server\Phaser 5550N PS"

    WshNetwork.SetDefaultPrinter "\\server\Phaser 5550N PS"


    Author Comment

    I didn't mean to close this so soon!

    I still have the problem of needing credentials supplied when connecting to the printer.

    I guess I will re-post a similar question if all else fails.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
    I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
    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…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    733 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

    20 Experts available now in Live!

    Get 1:1 Help Now