Batch file to disconnect and reconnect a network printer

metamatic
metamatic used Ask the Experts™
on
My server is running Windows server 2003 standard edition R2. i've just bought a new server with the same OS.

The old server runs about 6 network printers which approx 80 users connect to. I've installed and shared the printers on the new server and want to reconnect the users.

Can anybody let me know if there is an equivalent of the net use / net disconnect commands for printers that i can add to a batch file to achieve this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Own Company
Commented:
Also use a vbs script. deploy this via gpo

Example:

'Inhalt[anfang]
Dim WshNetwork
on error resume next
Set WshNetwork = WScript.CreateObject("WScript.Network")

'Add new Printer

WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_EGT"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_Z_0_1"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_Z_0_3"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_C_1OG"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_1_OGT"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_1_OG"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_Z_1_8"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_2_OGT"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_2_OG"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_Z_2_2"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\HP_Z_0_2"
WshNetwork.AddWindowsPrinterConnection "\\NTSRV1\CanonEG"

'Remove old Printer
WshNetwork.RemovePrinterConnection "\\P1BBH\BER_10_LaserJet_4100_1_OG" , TRUE, TRUE
WshNetwork.RemovePrinterConnection "\\P1BBH\BER_100_LaserJet_4250_4_OG" , TRUE, TRUE
WshNetwork.RemovePrinterConnection "\\P1BBH\BER_105_LaserJet_4100_4_OG" , TRUE, TRUE
WshNetwork.RemovePrinterConnection "\\P1BBH\BER_20_LaserJet_4050_1_OG" , TRUE, TRUE
WshNetwork.RemovePrinterConnection "\\P1BBH\BER_30_LaserJet_4250_2_OG" , TRUE, TRUE

Set WshNetwork = Nothing
'Inhalt[ende]

Author

Commented:
cheers

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial