Remapping network printers
Posted on 2005-03-09
I have 2 printers in an office here that i need to re map.
One is being de commissioned and the other moving into production.
We have changed the name slightley and have made a script to remove the old printers and add the new one.
What i need to add is something that will check and see if the printer is mapped or not already, and if its not mapped to the users computer then to skip removing the printer and adding it.
Here is the script i have now :
' Removing SHARP Sugarplumb
Dim WshPrinter, strPrinterPath
strPrinterPath1 = "\\caedmfsrv1\Sugarplumb"
strPrinterPath2 = "\\caedmfsrv1\FieryXP12"
Set WshPrinter = WScript.CreateObject("WScript.Network")
WshPrinter.RemovePrinterConnection strPrinterPath1, true, true
WScript.Echo "Removed Printer: " & strPrinterPath1
WshPrinter.RemovePrinterConnection strPrinterPath2, true, true
WScript.Echo "Removed Printer: " & strPrinterPath2
' Adding XEROX Sugarplumb
Dim objNetwork, strPrintPath
strPrintPath = "\\caedmfsrv1\Sugarplum"
Set objNetwork = CreateObject("WScript.Network")
WScript.Echo "Connected Printer: " & strPrintPath
' End of Script
So essentially the script should check to see if \\caedmfsrv1\Sugarplumb exists and if it does remove it then check to see if \\caedmfsrv1\FieryXP12 is there and remove it. Then if it removed 1 of those 2 then map the new printer.