Using Logon Scripts to Add and Remove Network Printers


Using Logon Scripts to Add and Remove Network Printers


It is often impractical to touch every user’s computer in your organization to remove a printer and add a new one. There is a simple way to add and remove network printers using a logon script.

Begin by insuring the printer being added has been installed on the print server and is shared and available in the network catalog. Insure drivers for both 32 and 64 bit operating systems are also installed. You are bound to have both in your environment. You can test the printer’s availability by simply opening an explorer window on a PC in the environment and typing: your_print_server_hostname. Look for your printer in the populated list. If you have set it up correctly, it should appear.

Printers List

Create a Visual Basic Script (VBS) to Add and Remove the Printers

1. Open a new Notepad document.
2. Enter the following text:

set objNetwork = CreateObject(“WScript.Network”)
objNetwork.RemovePrinterConnection “Your_print_serverprinter_name_being_removed”
objNetwork.AddWindowsPrinterConnection “Your_print_serverprinter_name_being_added”

3. Save the document on your domain controller under SYSVOLdomain localscriptsprinterinst.vbs. Insure it saves as a .vbs and not as a .txt


Set the Visual Basic Script to Run from Your Logon Script

1. If you already have a logon script, open it and add the following lines to call the .vbs script you just created:

    @echo off 
    Pushd %~dp0 
    Cscript printerinst.vbs

2. If you do not have a logon script, start a new notepad text document and add the lines above.
3. Save the document on your domain controller under: SYSVOLdomain.localscriptslogon.bat. Insure it saves as a .bat and not as a .txt
4. Set the script to run on user accounts in Active Directory Users and Computers by typing the script name under the profile tab for each user.


Profile Tab

Each user needs to log off and back on. The old printer should be gone, and the new printer should appear shortly. It takes some time to download the driver and install the printer. You have now successfully removed and installed network printers on multiple users’ PC from the comfort of your office chair!

KeepWatch by InterWorks

Whether you need support for one platform or many, our technical experts have you covered.

More About the Author

Scott Matlock

IT Lead and Training Coordinator
InterWorks University: Our Solution for Learning I was never taught how to study. I know this because of the overwhelming anxiety I felt recently as I attempted to prepare for a ...
Walk This May: A Tableau Data Viz Throughout the month of May 2021, InterWorks and members of the Stillwater, OK, public were challenged to create teams of two-five ...

See more from this author →

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK


Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Geschäftsführer: Mel Stephenson

Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072


Love our blog? You should see our emails. Sign up for our newsletter!