Solved

How to remove and add LOCAL printers via script

Posted on 2016-09-20
5
169 Views
Last Modified: 2016-09-23
Hello, I have an environment that I want to remove the printers (including the drivers) and add them back via a script.  These printers work best if they are LOCAL so I need to have them install via the local machine and not on a print server.

These systems are on a AD Domain with the DC having Windows 2008

Windows 7 64bit and 32bit systems.
0
Comment
Question by:tucktech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 30

Expert Comment

by:Randy Downs
ID: 41807967
Try this  .

VBS
set objNetwork = CreateObject(“WScript.Network”)
objNetwork.RemovePrinterConnection “\\Your_print_server\printer_name_being_removed”
objNetwork.AddWindowsPrinterConnection “\\Your_print_server\printer_name_being_added”

Open in new window


Logon Script
 @echo off 
    Pushd %~dp0 
    Cscript printerinst.vbs

Open in new window

0
 
LVL 12

Accepted Solution

by:
Sandeep earned 250 total points
ID: 41808486
You can use PrintUI tool to configure the script (.bat) and remove the network printer and add same printers as Local printers.

https://technet.microsoft.com/en-us/library/ee624057(v=ws.11).aspx

This article is self explaining so you should be able to try it on one system by using command prompt. Once you are sure it works save same commands in a batch file one after the other like printer removal command on first line and on next addition of printer. I assume you have same name of printer to add and remove on all machines. Then use same batch file to run from all machines and hope this should work.
0
 
LVL 25

Assisted Solution

by:Lionel MM
Lionel MM earned 250 total points
ID: 41808574
This site is similar to the one already provided -- I use it as my reference point so it may help you too http://windowsitpro.com/windows/how-can-i-add-printer-command-line; shows how to add, remove, & delete drivers & printers
0
 

Expert Comment

by:jdmailny
ID: 41811864
What is your exact question - this is not clear
0
 

Author Closing Comment

by:tucktech
ID: 41812285
Printui scripts are the way to go for this problem.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A safe way to clean winsxs folder from your windows server 2008 R2 editions
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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