Clear all print jobs using PowerShell

27.Oct.2013 | by Gusac | Filed in: Articles, Tutorials

Note: Cmdlet is available on Windows server 2012 but works remotely for previous versions. Windows Server 2012 has a new cmdlet Remove-PrintJob that helps delete the print jobs on the server. You need to specify either the Job ID or the Printer name. Example: Remove-PrintJob -ComputerName tctp22wspsx01 -PrinterName <TestPrinter> -ID 2 Clear all print jobs on the server The command below removes all the print jobs on remote computer. Get-Printer -ComputerName <SystemName>| Get-PrintJob | Remove-PrintJob or Removes all print jobs on the local system. Get-Printer | Get-PrintJob | Remove-PrintJob The above commands gets the list of printers on the system, pass it on the to next cmdlet which retrieves the print jobs on each of the printer. These jobs are then passed on to next cmdlet which finally removes the passed print jobs on the specified computer. Clear all print jobs older than X days Below example delete all print jobs older than 1 day: Get-Printer -ComputerName PrintServer1 | get-printjob | where{$_.SubmittedTime -lt ((Get-Date).adddays(-1))} | Remove-PrintJob (Get-Date).AddDays(-1)  - Change the value –1 to increase the number of days.

Troubleshoot - Printer status showing offline

18.Nov.2011 | by Gusac | Filed in: Articles, Troubleshoot

  There could be several reason for a printer to show the status as OFFLINE. But the most common that I have come around is due to the SNMP option in its properties. It is quite possible that printer does not support SNMP or SNMP is not enable/installed on the print server and yet SNMP option is enabled. Now due to this the print server tries to communicate with print device over SNMP. The server never gets the response and shows the printer status as offline. The simple solution is to disable the SNMP feature in printer properties. It does not have any affect on printing functionality of the printer. Open Printer and Faxes or Devices and Printers Right click on the problem printer and go to Printer properties In Printer properties window, go to the Ports tab On Ports tab, click on the button that says Configure Port…     In the new page, clear the checkbox that says SNMP Status Enabled and click OK to exit. Refresh the page, it should show status as Read now.

Permalink | Tags:


Fallback Printer Driver

22.Sep.2011 | by Gusac | Filed in: Articles, Tutorials

Overview of Fallback printer driver policy and how it is configured [More]

Overview of Printer Driver Isolation

23.Mar.2011 | by Gusac | Filed in: Articles, Tutorials

Print spooler crash isn't a rare phenomenon in IT Administration world. It is something that leaves an admin scratching his head, figuring out what is causing it. Most of the time it's due to some faulty printer driver and bigger the environment, harder it is to identify the culprit driver. But that's going to be the thing of past now. With Windows 2008 R2 and Windows 7 comes the Printer Driver Isolation. As the name suggests, Printer Driver Isolation or PDI isolate the printer drivers files into a different process than Print spooler (spoolsv.exe). The isolated printer drivers are not loaded in the process space of spoolsv.exe but instead a different process. So, if any problem that occurs in the faulty drivers will cause the process they are loading in to fail instead of spoolsv.exe, hence preventing the production down time for Print servers. The process that host the isolated printer driver files is PrintIsolationHost.exe. This process host the printer drivers which are set to be run isolated. If anything goes wrong with these drivers, they will cause PrintIsolationHost.exe to crash and not spoolsv.exe. The purpose of the driver isolation feature is to prevent print drivers that fail or behave badly from adversely affecting the print spooler process There are three modes of Printer Driver Isolation: None - Printer drivers are loaded in the spooler process, just like before. Shared - Printer drivers set to run in a single shared instance of PrintIsolationHost.exe process, separated from the spooler process. This is the default mode. Isolated - Each Printer driver is set to run in its own separate instance of PrintIsolationHost.exe process. To check if Printer Driver support PDI: Navigate to the following registry location: HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\<environment>\Drivers\Version-3\<driver>\PrinterDriverAttributes Possible values: 0: Printer driver does not support PDI 2: Printer driver supports PDI If the value is missing, it defaults to 0, that is, the driver does not support PDI   How to change the Printer Driver Isolation mode There are three ways to determine Isolation mode for Printer drivers: INF files associated with the printer driver Print Management Console (PMC) Group Policy   INF files associated with the printer driver The printer driver inf files advertises whether the driver supports PDI or not. The inf files contains a the keyword DriverIsolation to indicate its support for the PDI. As mentioned above, value 0 indicates that the driver does not support PDI and the value 1 indicates it supports it. So, in an inf file, it should look like: DriverIsolation=0 DriverIsolation=2 Again, If the keyword is not there then it defaults to 0       Print Management Console (PMC) The print management console or PMC lets you manage the driver isolation easily. If you open the PMC and go to the Drivers for the print server you want to manage, it will list all the print drivers installed on that server along with their Isolation state. Below is the screenshot for your reference: To change the Driver isolation, right click on the printer driver and select the option 'Set Driver Isolation. The drop down menu will all the available options. Please note: The System Default option is the setting defined in the driver itself by default or by group policy. If group policy ‘Execute Print drivers in isolated processes’ is Disabled, then you cannot change the isolation mode. Registry value for PDI settings: The driver names, for which PDI mode was set explictly, are stored in registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\ [PrintDriverIsolationGroups] The value data is stored in a format to differentiate the Isolation state. the format is: <None>\<None>\\<Shared>\<Shared>\\<Isolated>\<Isolated> The three groups (None, Shared & Isolated) are separated by double slashes ‘\\’ and within each group, drivers are separated by single slash ‘\’ Please note: For drivers which have Driver Isolation state as System Default, will not be listed in the registry. The registry contains names for the drivers for which PDI mode was change explicitly. If you do not have any driver in one group then it will be left as it is but double slashes \\ would still be there.   Group Policy There are two group policies for PDI ad they can be found under: Computer Configuration\Administrative Templates\Printers. The Group policies are: Execute print drivers in isolated processes Override print driver execution compatibility setting reported by print driver Policy: Execute print drivers in isolate processes: This policy setting determines whether the print spooler will execute print drivers in an isolated or separate process. When print drivers are loaded in an isolated process (or isolated processes), a print driver failure will not cause the print spooler service to fail. If you enable or do not configure this policy setting, the print spooler will execute print drivers in an isolated process by default. If you disable this policy setting, the print spooler will execute print drivers in the print spooler process. Notes: -Other system or driver policy settings may alter the process in which a print driver is executed. -This policy setting applies only to print drivers loaded by the print spooler. Print drivers loaded by applications are not affected. -This policy setting takes effect without restarting the print spooler service.   Policy: Override print driver execution compatibility setting reported by print driver: This policy setting determines whether the print spooler will override the Driver Isolation compatibility reported by the print driver. This enables executing print drivers in an isolated process, even if the driver does not report compatibility. If you enable this policy setting, the print spooler will ignore the Driver Isolation compatibility flag value reported by the print driver. If you disable or do not configure this policy setting, the print spooler will use the Driver Isolation compatibility flag value reported by the print driver. Notes: -Other system or driver policy settings may alter the process in which a print driver is executed. -This policy setting applies only to print drivers loaded by the print spooler. Print drivers loaded by applications are not affected. -This policy setting takes effect without restarting the print spooler service.

Overview of Terminal Server Fallback Printer Driver

3.Feb.2010 | by Gusac | Filed in: Articles, Tutorials

Overview of what is Fallback printer driver and how to configure it via Group policy and registry [More]

Unable to set Default Printer in Terminal Session

12.Dec.2009 | by Gusac | Filed in: Articles, Troubleshoot

Unable to get default printer in rdp or ica session. [More]