Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

hi all, we run a 2003 server domain with xp client. i have just renamed the priniters on ther server but not changed the share name or port etc. our printer are connected to clients using a VB script in a Group Policy. This is all working well. the problem i have is that now i have chaged the name there is the old name which wont work any more AND the new one which does work. how can i delete the old printer connection across the whole network of clients. do i have to go to each work station and delete the profiles?

 

cheers :?

Posted

try this code

 

On Error Resume Next

 

 

 

Set objNetwork = CreateObject("WScript.Network")

 

Set objShell = WScript.CreateObject("WScript.Shell")

 

Set colSystemEnvVars = objShell.Environment("Process")

 

 

objNetwork.RemovePrinterConnection "\\pserver\room32"

objNetwork.RemovePrinterConnection "\\pserver\room32C"

 

 

but use your server and printer name

Posted

thanks for the help but i dont think i explained it very well. the problem is not with the server the problem is the Xp clients having 2 printer connections showning but it is the same printer one with an old name and one with the new name. how can i delete the old name from the clients across all users.

cheers

Posted

use the script about to remove the printers before your script runs by just adding the lines in the have it add them afterwards.

 

We have the same problem with it being the profile remebering the printer thats why we use the remove printer connection first.

Posted
thanks for the help but i did not work, is there no way to get windows to delete printer connections which are offline or dead

Your best bet is to use one of the printer scripts as a login script to remove all networked printers on workstations and then add the current ones.

 

Works fine for me and would resolve your problem in a heart beat.

Posted

That should work I use:

 

dim wNet

set wNet = createobject("wscript.network")

'Remove ALL old printers

'Enumerate all printers first, after that you can select the printers you want by performing some string checks

Set WSHPrinters = WNet.EnumPrinterConnections

For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2

'To remove only networked printers use this If Statement

If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) = "\\" Then

WSHNetwork.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER +1),True,True

End If

'To remove all printers incuding LOCAL printers use this statement and comment out the If Statement above

'WSHNetwork.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER +1),True,True

Next

'end delete existing printers

 

Which does the same thing but will just loop through all the printer connections itself.

 

Ben

Posted
There is the old con2prt.exe that was included in the nt4 admin kit, but i have never used it on nt4 (never even used it) and running that with the /f command deltes all connections.
Posted

Will do the same as BKGarry's script - it will remove all installed printers first...

 

rem ** Next line must not be deleted **

Set WshNetwork = CreateObject("WScript.Network")

 

rem ** This will delete existing printers **

On Error Resume Next

Set oPrinters = WshNetwork.EnumPrinterConnections

For i = 1 to oPrinters.Count - 1 Step 2

WshNetwork.RemovePrinterConnection oPrinters.Item(i)

Next

 

Set WshNetwork = CreateObject("WScript.Network")

WshNetwork.AddWindowsPrinterConnection "\\YOURSERVER\PRINTER"

WshNetwork.AddWindowsPrinterConnection "\\YOURSERVER\PRINTER"

WshNetwork.AddWindowsPrinterConnection "\\YOURSERVER\PRINTER"

 

 

rem ** Setup default printer **

WshNetwork.SetDefaultPrinter "\\YOURSERVER\PRINTER"

Posted

Just a thought, the old one isn't installed through the method of adding a local port on the machine pointing to the server and then installing the drivers.

 

That could be why it is still there because we are all trying to delete a network printer, not a local printer that prints to a network port.

Posted

Mattx your script does the same as the one I posted excpet that mine has the option in it to only delete network printers or to delete all printers like yours does.

 

Ben

Posted
You could also try running the script as a startup script if the printer connection has some how got stuck in there as a local printer.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...