Published printers from AD disappear
Published printers from AD disappear
This normally happens when we have Print Pruning Policy Configured.
The Printer Pruner is a component of the Windows Spooler service that deletes orphaned PrintQueue objects from the Active Directory. The Printer Pruner runs within the Spooler context, and only on domain controllers. The purpose of the Printer Pruner is to eliminate PrintQueue objects from the Active Directory whose UNCName attribute points to a non-existent or incorrect printer.
Troubleshooting for Published Printers Are Missing:
===========================================
1. Launch GPEdit.msc on the Print Server.
2. Navigate to Computer Configuration / Administrative Templates / Printers.
3. Configure the Allow Pruning of Published Printers policy to Disabled.
4. Refresh group policy.
By default the DC checks 3 times with 8 hours between checks to determine if the
printer is still valid before deleting it.
“The Print Pruner is a thread that runs under the spooler context on all DCs. It
uses ADSI calls ( ADsGetObject, IID_IDirectorySearch->ExecuteSearch) to get the
list of all the printQueue servers in the AD.
To check whether the server is in same site it uses Winsock call (gethostbyname)
and other net APIs (DsAddressToSiteNames,DsGetDcSiteCoverage).
To check if the print queue\print server availability it uses OS APIs
(NetServerGetInfo, OpenPrinter,GetPrinter).
So all the work by pruner is done using ADSI, WinSock and OS functions.”
Work-around to get the Disappeared Printers back:
==========================================
Click on Start, Run, Services.msc
Stop and restart "Print Spooler" service
Note: When the spooler service is restarted on a print server it automatically republishes the printers.
Note: On a cluster service, just stop the Print Spooler service, since the cluster service will automatically start the service when it tries to bring the Print resource online.
Here is a script to republish all the printers to Active Directory
Please save this as a *.vbs and run it as a script file.
'
' This VBS enables printer publishing
'
' Created by Austin Mack. Last modified on 8/19/2005
'
' Note: The command generated for each printer will display an error for each printer, if
' it is unable to enable publishing for the printer, for example lack of permissions.
'
' Following link has a list of printer attributes.
' https://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32\_printer.asp
' Attributes of a Windows printing device are represented by a combination of flags.
' Shared Attribute = 8 (ie Available as a shared network resource)
'
' Additional PRINTUI.DLL syntax information available by running the following command
' rundll32 printui.dll,PrintUIEntry /?
Option Explicit
on error resume next
Dim Key 'The dictionary key to each item
Dim objLocator, objService, objEnumerator
Dim objWSH, strComputerName
Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set objWSH = CreateObject("WScript.Network")
strComputerName = objWSH.ComputerName
set objLocator = CreateObject("WbemScripting.SWbemLocator")
set objService = objLocator.ConnectServer(strComputerName,"root/cimv2")
set objEnumerator = objService.ExecQuery("SELECT * FROM win32_Printer")
Wscript.echo "A message will be displayed after printers are published on ALL of the local printers that are shared. However it may take a little longer for the GUI to get updated" & vbcrlf & "Click OK to continue"
For each key in objEnumerator 'cycle through each printer on the system
if ((key.attributes and 8) = 8 ) then 'Only execute printer is shared
if (left(key.name,2) <> "\\") then 'Only execute if printer is not a UNC network printer (ie should be local)
'wscript.echo key.name 'Display each printer that is about to have DS print publishing enabled.
WSHShell.Run("rundll32 printui.dll,PrintUIEntry /Xs /n """ & key.name & """ attributes +Published")
end if
end if
Next
Wscript.echo "Printer publishing has been enabled for the local printers that were shared on this system"
Comments
- Anonymous
January 01, 2003
PingBack from http://www.keyongtech.com/5018101-print-sharing