Table of Contents
The UniversalPrintManagement PowerShell module is designed for managing and administrating Universal Print resources from the command line. Use this module when you want to build automated tools.
This article helps you get started with UniversalPrintManagement module and teaches the core concepts behind it.
Install Universal Print PowerShell Module
1. Right click on the Windows Start icon 🪟 then select Windows PowerShell (Admin).
2. Run the following command to install the Nuget provider then install the Universal Print PowerShell module.
##Add Repopsitory
Install-PackageProvider -Name 'NuGet' -Force
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
##Install module
Install-Module UniversalPrintManagement
3. Run the following command to verify the module is installed successfully.
PS C:\> Get-InstalledModule UniversalPrintManagement
Version Name Repository Description
------- ---- ---------- -----------
1.11.0 UniversalPrintManagement PSGallery To report issues, please create a ...
UniversalPrintManagement cmdlets follow a standard naming convention for PowerShell, VERB-NOUN. The verb describes the action (examples include Get, Set, Grant, Revoke) and the noun describes the resource type (examples include UPPrinter, UPPrintJob, UPAccess).
Knowing the nouns and verbs help you find commands with the Get-Command cmdlet. For example, to find commands that use the Get verb:
PS C:\> Get-Command -Verb Get -Module UniversalPrintManagement
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Get-UPAllowedMember 1.11.0 UniversalPrintManagement
Cmdlet Get-UPConnector 1.11.0 UniversalPrintManagement
Cmdlet Get-UPPrinter 1.11.0 UniversalPrintManagement
Cmdlet Get-UPPrinterShare 1.11.0 UniversalPrintManagement
Cmdlet Get-UPPrintJob 1.11.0 UniversalPrintManagement
Cmdlet Get-UPUsageReport 1.11.0 UniversalPrintManagement
Sign in to Universal Print
1. Sign in interactively with the Connect-UPService cmdlet.
Connect-UPService
You’ll get a sign-in dialog to provide a username and password for your Azure account or select one of the previously saved accounts.
2. Once signed in, use the available cmdlets in the module to access and manage printer resources. Use the below cmdlet to get information about a single or list of printers.
Get-UPPrinter
By default, the result of the command shown in array. In this case, we’ve two printed are registered in Universal Print.
# Output
Results ContinuationToken
------- -----------------
{{DisplayName: HP LaserJet Pro M402}, {DisplayName: Canon LBP161}}
If you want to get more information about the printers. You can extract them from the array. For example, we can get the printerid, displayname, shares and more.
PS C:\> (Get-UPPrinter).Results
Id : ceb11992-16d3-4f46-8e16-2b07e050521b
DisplayName : HP LaserJet Pro M402
Manufacturer : HP
Model : HP LaserJet Pro M402-M403 n-dne
IsAcceptingJobs : True
Defaults :
Location : Microsoft.UPManagement.Models.PrinterLocation
Capabilities :
Status : Microsoft.UPManagement.Models.PrinterStatus
Jobs :
RegisteredDateTime : 3/16/2023 3:55:27 AM +00:00
IsShared : True
HasPhysicalDevice : False
Shares : {{DisplayName: Second Floor Printer}}
Connectors :
Run the below command to get the information of printer shares in Universal Print tenant.
PS C:\> (Get-UPPrinterShare).Results
Id : 1aff7481-37a0-45c6-ba9f-ac6b6e0be61e
DisplayName : First Floor Printer
AllowAllUsers : True
CreatedDateTime : 3/15/2023 2:26:36 PM +00:00
Printer : {DisplayName: HP LaserJet Pro M402-M403 n-dne PCL 6}
Universal Print PowerShell Use Case Samples
Batch unshare printers, this example shows unsharing of all shared printers:
$Printers = Get-UPPrinter
$Printers.Results.Shares | Remove-UPPrinterShare
Batch grant all users access to shared printers:
Connect-UPService
$PrinterShares = Get-UPPrinterShare
$PrinterShares.Results | Grant-UPAccess -AllUsersAccess
Batch grant users or user groups access to shared printers:
Connect-AzAccount
$Users = Get-AzADUser -First 10
$UserGroups = Get-AzADGroup -SearchString 'Contoso'
Connect-UPService
$PrinterShares = Get-UPPrinterShare
$Users | ForEach-Object {$PrinterShares.Results | Grant-UPAccess -UserID $_.Id}
$UserGroups | ForEach-Object {$PrinterShares.Results | Grant-UPAccess -GroupID $_.Id}
Batch set printer location properties:
$Printers = Get-UPPrinter
$Printers.Results | Set-UPPrinterProperty `
-Latitude 47.642391 `
-Longitude -122.137001 `
-Organization "Contoso" `
-Site "Main Campus" `
-City "Redmond" `
-Building "101"
Filter the printer share base on its share name:
$printer = (Get-UPPrinter).Results | Where-Object {$_.Shares.DisplayName -eq "First Floor Printer"}
$printer | Format-List
# Output
Id : e92a00b8-437d-43bd-b538-6c4e28431c65
DisplayName : Canon LBP161
Manufacturer : HP
Model : HP LaserJet Pro M402-M403 n-dne
IsAcceptingJobs : True
Defaults :
Location : Microsoft.UPManagement.Models.PrinterLocation
Capabilities :
Status : Microsoft.UPManagement.Models.PrinterStatus
Jobs :
RegisteredDateTime : 3/16/2023 3:09:22 AM +00:00
IsShared : True
HasPhysicalDevice : False
Shares : {{DisplayName: First Floor Printer}}
Connectors