Log in

View Full Version : VBS Login Scripts Remove Network Printers


Mark Kenepp
10-28-2006, 12:34 AM
Anyone familiar with VBS Login Scripting (Windows Server 2003 with XP Workstations)?

I am trying to set up some scripting to set up mapped drives and network printers on the workstations.

I have found this resource (http://www.computerperformance.co.uk/Logon/logon_scripts.htm) which has given me all the information that I need, almost.

I have set up and tested batch files and VBScripts that will map the required network drives and attach the appropriate printers which is the most important thing but...

I would like to be able to remove printers that exist on the old print server before I take it out of commission.

The resource I have linked above gives examples for removing the printers but, it would mean that I need to know exactly which printers are set up on each workstation. One option is to just create the script to add all the printers that exist on the server first then remove them all. What I would rather do, is just create a script that will remove all and ONLY the network printers from the old server. I don't want to remove all printers since that will remove any local printers, such as fax and PDF printers.

Am I being clear?

TIA

mclannahan
11-07-2006, 05:26 PM
Hello!

I think you need the print scripts in the system32 directory on your server. Here there is a script called prnmngr.vbs. This can delete all types of printers using the correct switch (local printers, connections etc..)

C:\>cscript prnmngr.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Usage: prnmngr [-adxgtl?][c] [-s server][-p printer][-m driver model]
[-r port][-u user name][-w password]
Arguments:
-a - add local printer
-ac - add printer connection
-d - delete printer
-g - get the default printer
-l - list printers
-m - driver model
-p - printer name
-r - port name
-s - server name
-t - set the default printer
-u - user name
-w - password
-x - delete all printers
-xc - delete all printer connections
-xo - delete all local printers
-? - display command usage

Examples:
prnmngr -a -p "printer" -m "driver" -r "lpt1:"
prnmngr -d -p "printer" -s server
prnmngr -ac -p "\\server\printer"
prnmngr -d -p "\\server\printer"
prnmngr -x -s server
prnmngr -xo
prnmngr -l -s server
prnmngr -g
prnmngr -t -p "\\server\printer"

I use it and it works a treat!!

Hope this helps....Don't run it directly on your server and wipe all your shared printers though!!

Michael

Guy Romanio
01-30-2007, 09:37 AM
It's much easier to do this exact thing with special 3rd party software. I can recommend you try Scriptlogic (http://www.scriptlogic.com)'s solution - desktop authority.
You don't need to manage with scripts if you can do the same things and even more with graphical gui interface.