How to Remove a Printer with Batch Script


Whether you manage a small office workgroup or a large corporate network, adding and removing shared resources on individual systems takes a considerable amount of time. If you need to remove shared printers for all users on a network, use a batch file and logon script to automate the process when users log into their computers. Logon Scripts make tasks such as removing printers as simple as create a smile command file in Windows Notepad and storing it in a network folder.

Click “Start” and then type “notepad” into the search box. Press the enter key. Wait for Windows Notepad to open and display a blank text document.

Enter the following code into the blank text document:

Option Explicit Dim objWorkgroup, strPrinterToDelete, bForce, bUpdateProfile strPrinterToDelete = "\PrintServer\printername" bForce = "True" bUpdateProfile = "True" Set objWorkgroup = CreateObject("WScript.Network") objWorkgroup.RemovePrinterConnection strPrinterToDelete, bForce, bUpdateProfile WScript.Echo "Check Printers folder NO: " & strPrinterToDelete Wscript.Quit

Replace the "\PrintServer\printer_name" value with the network path to the printer you want to delete from user accounts.

Click “File/Save” on the Notepad menu bar. Enter “RemovePrinter.bat” or something similar in the “Save As” field and click the “Save” button.

Click “Start” and then “Control Panel.” When the “Adjust Your Computer’s Settings” window appears, click the “Administrative Tools” link.

Click the “Computer Management” link in the right side of the “Administrative Tools” window. Click the “Local Users and Policies” link on the left side of the screen when the “Computer Management” window pops up.

Right-click a user name on the list, then click “Properties” on the pop-up window. Click the “Profile” tab. Enter the folder path to the “RemovePrinter.bat” file in the “Logon Script” field. Click the “OK” button.

Update the “Logon Script” field on the “Profile” tab for all users. Whenever a user logs onto the network, the printer is deleted and no longer accessible.

Related Searches


Promoted By Zergnet


Related Searches

Check It Out

Are You Really Getting A Deal From Discount Stores?

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!