IT tutorials
 
Technology
 

Windows Server 2012 : Managing print servers using Windows PowerShell (part 1) - Viewing information about printers, printer drivers, and print jobs

5/19/2014 1:43:39 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Viewing information about printers, printer drivers, and print jobs

Windows Server 2012 includes a new Windows PowerShell module called PrintManagement that contains cmdlets you can use for viewing and managing printers, printer drivers, and print jobs. You can use the Get-Command cmdlet to display a list of PrintManagement cmdlets as follows:

PS C:\> Get-Command -Module PrintManagement

CommandType Name ModuleName
----------- ---- ----------
Function Add-Printer PrintManagement
Function Add-PrinterDriver PrintManagement
Function Add-PrinterPort PrintManagement
Function Get-PrintConfiguration PrintManagement
Function Get-Printer PrintManagement
Function Get-PrinterDriver PrintManagement
Function Get-PrinterPort PrintManagement
Function Get-PrinterProperty PrintManagement
Function Get-PrintJob PrintManagement
Function Remove-Printer PrintManagement
Function Remove-PrinterDriver PrintManagement
Function Remove-PrinterPort PrintManagement
Function Remove-PrintJob PrintManagement
Function Rename-Printer PrintManagement
Function Restart-PrintJob PrintManagement
Function Resume-PrintJob PrintManagement
Function Set-PrintConfiguration PrintManagement
Function Set-Printer PrintManagement
Function Set-PrinterProperty PrintManagement
Function Suspend-PrintJob PrintManagement

The following sections describe how to perform the following tasks:

  • Retrievea list of printers installed on a print server

  • View information about pending print jobs

  • View information about printers

  • View information about printer drivers and ports

Retrieve a list of printers installed on a print server

You can use the Get-Printer cmdlet to display a list of the installed printers on a print server. For example, the following command shows that there are four printers installed on a remote print server named HOST7:

PS C:\> Get-Printer -ComputerName HOST7 | Format-List Name,DriverName

Name : Samsung CLP-410 Series PCL6
DriverName : Samsung CLP-410 Series PCL6


Name : HP LaserJet 4200L PCL6
DriverName : HP LaserJet 4200L PCL6 Class Driver


Name : Microsoft XPS Document Writer
DriverName : Microsoft XPS Document Writer v4


Name : HP LaserJet 5200 PCL6
DriverName : HP LaserJet 5200 PCL6 Class Driver

You can pipe the output from the preceding command into the Where-Object cmdlet to determine which of these printers are shared:

PS C:\> Get-Printer -ComputerName HOST7 | where Shared -eq $true | fl Name

Name : Samsung CLP-410 Series PCL6
Name : HP LaserJet 4200L PCL6
Name : HP LaserJet 5200 PCL6

Viewing information about pending print jobs

Using the Get-Printer cmdlet as follows indicates that one of the printers on HOST7 has Error for its status:

PS C:\> Get-Printer -ComputerName HOST7 | where PrinterStatus -eq Error | `
fl Name,JobCount

Name : HP LaserJet 5200 PCL6
JobCount : 3

To view more information about the cause of this error, you can use the Get-PrintJob cmdlet like this:

PS C:\> Get-PrintJob -ComputerName HOST7 -PrinterName "HP LaserJet 5200 PCL6"

Id ComputerName PrinterName DocumentName SubmittedTime JobStatus
-- ------------ ----------- ------------ ------------- ---------
3 HOST7 HP LaserJet ... Document 3 8/26/2012 2:08:06 PM Error, Print...
4 HOST7 HP LaserJet ... Document 2 8/26/2012 2:08:06 PM Normal
5 HOST7 HP LaserJet ... Document 1 8/26/2012 2:08:06 PM Normal

The first print job in the queue (job #3) is generating the error condition. You can find out more information about this job as follows:

PS C:\> Get-PrintJob -ComputerName HOST7 -PrinterName "HP LaserJet 5200 PCL6" | `
where Id -eq 3 | fl JobStatus,UserName

JobStatus : Error, Printing, Retained
UserName : kberg

The fact that the job status includes Retained suggests that either the print job is corrupted or the print device is offline or out of paper. Either way, user Karen Berg should probably be informed because the print job belongs to her.

You can also use the Windows PowerShell pipeline with certain combinations of cmdlets in the PrintManagement module. For example, you can pipe the output from the Get-Printer cmdlet into the Get-PrintJob cmdlet to view all pending print jobs on all printers installed on a print server:

PS C:\> Get-Printer -ComputerName HOST7 | Get-PrintJob

Id ComputerName PrinterName DocumentName SubmittedTime JobStatus
-- ------------ ----------- ------------ ------------- ---------
2 HOST7 Samsung CLP-... Document 4 8/27/2012 3:54:33 PM Normal
3 HOST7 HP LaserJet ... Document 3 8/26/2012 2:08:06 PM Error, Print...
4 HOST7 HP LaserJet ... Document 2 8/26/2012 2:08:06 PM Normal
5 HOST7 HP LaserJet ... Document 1 8/26/2012 2:08:06 PM Normal

Viewing information about printers

You can use the Get-PrinterConfiguration cmdlet to display the configuration settings for a particular printer:

PS C:\> Get-PrintConfiguration -ComputerName HOST7 -PrinterName "HP LaserJet 5200 PCL6"

PrinterName ComputerName Collate Color DuplexingMode
----------- ------------ ------- ----- -------------
HP LaserJet ... HOST7 True False OneSided

Using the pipeline also allows you to display configuration settings for all printers installed on a remote printer server:

PS C:\> Get-Printer -ComputerName HOST7 | Get-PrintConfiguration

PrinterName ComputerName Collate Color DuplexingMode
----------- ------------ ------- ----- -------------
Samsung CLP-... HOST7 False True OneSided
Microsoft XP... HOST7 False True OneSided
HP LaserJet ... HOST7 True False OneSided
HP LaserJet ... HOST7 True False OneSided

If you want to list all color printers installed on HOST7, you can do it like this:

PS C:\> Get-Printer -ComputerName HOST7 | Get-PrintConfiguration | `
where Color -eq $true | fl PrinterName

PrinterName : Microsoft XPS Document Writer
PrinterName : Samsung CLP-410 Series PCL6

Another cmdlet Get-PrinterProperty allows you to display additional properties for an installed printer like this:

PS C:\> Get-PrinterProperty -ComputerName HOST7 `
-PrinterName "Samsung CLP-410 Series PCL6"

ComputerName PrinterName PropertyName Type Value
------------ ----------- ------------ ---- -----
HOST7 Samsung CLP-410 S... FormTrayTable String
HOST7 Samsung CLP-410 S... Config:DuplexUnit String FALSE
HOST7 Samsung CLP-410 S... Config:OptTray2 String FALSE
HOST7 Samsung CLP-410 S... Config:OptTray3 String FALSE
HOST7 Samsung CLP-410 S... Config:OptTray4 String FALSE
HOST7 Samsung CLP-410 S... Config:OptTray5 String FALSE

Viewing information about printer drivers and ports

Earlier in this lesson, you used the Get-Printer cmdlet earlier to list the printers installed on print server HOST7:

PS C:\> Get-Printer -ComputerName HOST7 | Format-List Name,DriverName

Name : Samsung CLP-410 Series PCL6
DriverName : Samsung CLP-410 Series PCL6

Name : HP LaserJet 4200L PCL6
DriverName : HP LaserJet 4200L PCL6 Class Driver

Name : Microsoft XPS Document Writer
DriverName : Microsoft XPS Document Writer v4

Name : HP LaserJet 5200 PCL6
DriverName : HP LaserJet 5200 PCL6 Class Driver

The drivers for the two HP printers have “Class Driver” in their names, which indicates they are v4 drivers, and the driver for the Microsoft XPS Document Writer printer is clearly a v4 driver as well. But what about the Samsung driver? The driver for this printer has neither “v4” nor “Class Driver” in its driver name, so could it be a v3 driver instead of a v4 type?

An easy way to determine this is to use the Get-PrinterDriver cmdlet like this:

PS C:\> Get-PrinterDriver -ComputerName HOST7 -Name "Samsung*"

Name PrinterEnvironment MajorVersion Manufacturer
---- ------------------ ------------ ------------
Samsung CLP-410 Series PCL6 Windows x64 4 Samsung

Clearly, the Samsung driver is of the v4 type.

Another useful cmdlet is Get-PrinterPort, which allows you to retrieve a list of printer ports installed on a print server. For example, the following command displays information about all ports on HOST7 of the Standard TCP/IP Port type:

PS C:\> Get-PrinterPort -ComputerName HOST7 | where Description -like "*TCP*"

Name ComputerName Description PortMonitor
---- ------------ ----------- -----------
172.16.11.55 HOST7 Standard TCP/IP Port TCPMON.DLL
 
Others
 
- Windows 8 : System Protection and Recovery - Advanced recovery and restoration options
- Windows 8 : System Protection and Recovery - Advanced settings and features for Windows recovery
- Sharepoint 2013 : Managing an Office 365 SharePoint Site - Create a New Public Site Collection
- Sharepoint 2013 : Managing an Office 365 SharePoint Site - Create a New Private Site Collection
- Sharepoint 2013 : Managing an Office 365 SharePoint Site - Sign In to Office 365 SharePoint Administrator Console
- Sharepoint 2013 : Authoring Pages - Discard the Check-out of a Page, Compare Versions of a Page
- Sharepoint 2013 : Authoring Pages - Publish a Page
- Sharepoint 2013 : Authoring Pages - Reuse a Web Part
- Sharepoint 2013 : Authoring Pages - Modify a Web Part
- Sharepoint 2013 : Authoring Pages - Use Built-in Web Parts (part 3) - Use the Content Query Web Part in SharePoint Server
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us