This sample can help you to get the total number of the printers hosted on your print Server by using PowerShell.
It is important to note that the primary limitation of the print server in this configuration is related to remote management and not the result of constraints imposed by the print server hardware or core spooler component. Specifically, when you are viewing and sorting columns in the Printers and Faxes folder, the Server may begin to experience delays if it is hosting more than 1,500 printers. You can run this script to get the total number of the printers hosted on your print Server.
This script contains one advanced function:
You can use this script in the following ways (You need run the script as administrator):
Method 1:
Method 2:
To obtain the detailed information about how to use the functions, run the following command to retrieve the help information:
Get-Help functionName -detailed
For example:
Get-Help Measure- OSCPrinterCountTheServerHosted -detailed
Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
$PrintSpoolerResources = Get-OSCAllPrintSpoolerResources
If ($PrintSpoolerResources.Count -gt 0) {
Foreach($Resource in $PrintSpoolerResources){
$PrintsInCurrentResource = Get-Item -Path `
(-join("HKLM:\Cluster\Resources\", $Resource.ID,"\Printers"))`
-ErrorAction SilentlyContinue
$PrinterCountTheServerHosted += $PrintsInCurrentResource.SubKeyCount
}
}
Else{
$PrintsInCurrentResource = Get-ChildItem -Path `
"HKLM:\SYSTEM\CurrentControlSet\Control\Print\Printers"
$PrinterCountTheServerHosted += $PrintsInCurrentResource.Count
}
$PrintSpoolerResources = Get-OSCAllPrintSpoolerResources If ($PrintSpoolerResources.Count -gt 0) { Foreach($Resourcein$PrintSpoolerResources){ $PrintsInCurrentResource = Get-Item-Path ` (-join("HKLM:\Cluster\Resources\", $Resource.ID,"\Printers"))` -ErrorAction SilentlyContinue $PrinterCountTheServerHosted+= $PrintsInCurrentResource.SubKeyCount } } Else{ $PrintsInCurrentResource = Get-ChildItem-Path ` "HKLM:\SYSTEM\CurrentControlSet\Control\Print\Printers"$PrinterCountTheServerHosted+= $PrintsInCurrentResource.Count }
Example 1: Get the total number of the printers hosted on your print Server
Command: Measure-OSCPrinterCountTheServerHosted
Screenshot:

Windows PowerShell 2.0
Microsoft Windows Print Server
Technical Resources:
Windows Print Server Scalability and Sizing Reference System
MSCluster_Resource class