Jump to content

Recommended Posts

Posted

This has been driving me mad...

 

Windows 2008 FRDC server with Windows 7 clients on domain.

Domain user accounts don't have a profile, profile location on Active Directory is left blank. We use Ranger 8 to distribute shared icons and netmaps.

Shared printers are deployed via Group Policy.

 

Over the years, printers have been added and removed from the server in varying methods, one of which I presume is manually.

 

As a consequence, when a user logs in, they are given a list of around 12 printers (we only have three now).

The rest are all incredibly old ones which were gone years ago. I have tried running DelProf for all locally cached user accounts, however when that user logs in again, I can see that all of the other defunct printers are still showing.

 

If I log in to each machine and manually remove all printers. They then stay gone for good. Is there no way of automating this frustrating process?

Posted

if the printers are added via policy then you can remove then via policy as well, GPP preferences should allow you to remove unwanted items.

if you need to script something to run to give you a clean slate i have used rundll32 printui.dll,PrintUIEntry with success in the past.

  • Thanks 1
Posted
if the printers are added via policy then you can remove then via policy as well, GPP preferences should allow you to remove unwanted items.

if you need to script something to run to give you a clean slate i have used rundll32 printui.dll,PrintUIEntry with success in the past.

 

Yes, I know how to do it via policy, but unfortunately these were either done by netlogon or manually by someone else in the past. It is a right mess as you can't tell a genuine printer from the defunct old stuff.

 

I have not used rundll32 printui.dll,PrintUIEntry before. But will look up and see if I can find any scripts. To add to the complications, it seems different rooms have varying names and models of printers from years gone by, which will make scripting a pain.

Posted

Using GPP Control Panel>Printers>Shared Printer>"Delete all shared printers" before assigning the current printers seems to do the trick here.

 

We used to run this vbs at log off previously. Only does network printers IIRC.

 

'==========================================================================
'
' NAME: RemoveNetPrinters.vbs
' COMMENT: Remove all net printers
'
'==========================================================================
ON ERROR RESUME NEXT
Set wshNet = CreateObject("WScript.Network")
Set wshPrn = wshNet.EnumPrinterConnections
For x = 0 To wshPrn.Count - 1 Step 2
If Left(wshPrn.Item(x+1),2) = "\\" Then wshNet.RemovePrinterConnection wshPrn.Item(x+1),True,True
Next
'==========================================================================

Posted

I remove all printers at logoff by script then use GPO to add them by computer or by user dependant on need.

 

On Error Resume Next

 

Const NETWORK = 22

Set objNetwork = CreateObject("WScript.Network")

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & strComputer & "\root\cimv2")

Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer")

 

For Each objPrinter in colPrinters

If objPrinter.Attributes And NETWORK Then

strPrinter = objPrinter.Name

objNetwork.RemovePrinterConnection strPrinter

End If

Next

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...