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!

More About the Author

Scott Matlock

Regional IT Practice Lead
To Infinity and Beyond: The Power of the Cloud in IT As we hit refresh on a new month, new year and new decade, it makes sense for us to look back on the road that brought us to where we ...
You Down with SOP? My kids are terrible at doing their chores. Each day, my highly organized wife leaves a list of items that must be accomplished before ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

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