Manage Universal Print using PowerShell

In this blog post, I will show you how to manage Universal Print using PowerShell. Microsoft provides a PowerShell module called UniversalPrintManagement for managing and administering Universal Print (UP). We will install this module on our device and run commands that are useful for managing printers in the cloud. Using these PowerShell cmdlets, you can retrieve printer lists, view printer shares, grant or revoke printer access, export reports for inventory purposes, and more.

You can use the cmdlets in the module either interactively or non-interactively. To create a non-interactive connection with Universal Print, you must store the user password securely and retrieve it for authentication. For more information, refer to the link: Non-Interactive UP Connection.

Universal Print PowerShell Reference

In the following sections, you’ll find PowerShell commands from the UniversalPrintManagement module. We’ll start by installing the module, then connect to Universal Print using an account with either the Global Administrator or Printer Administrator role. Let’s get started.

Install and Connect with Universal Print

Open the PowerShell console as an administrator and run the following commands to install and connect to Universal Print. When using the Connect-UPService cmdlet, ensure you sign in with an account that has permission to manage Universal Print. For more information, refer to the link: Universal Print RBAC roles.

Install Universal Print Management module

Install-Module UniversalPrintManagement

Connect to Universal Print

Connect-UPService

UniversalPrintManagement PowerShell Module Cmdlets

Below is a list of cmdlets available in the UniversalPrintManagement PowerShell module. You can display the full list by running the following command in the PowerShell console.

UniversalPrintManagement module cmdlets

 Get-Command -module UniversalPrintManagement
Cmdlets in UniversalPrintManagement PowerShell Module
CommandDescriptionExample
Connect-UPServiceSign in and connect to Microsoft Universal Print.Connect-UPService
Get-UPAllowedMemberList users or groups with access to a printer share.Get-UPAllowedMember -PrinterShareId <ShareID>
Get-UPConnectorRetrieve details of Universal Print connectors.Get-UPConnector
Remove-UPConnectorUnregister a Universal Print connector.Remove-UPConnector -Id <ConnectorID>
Get-UPPrinterGet details of registered Universal Print printers.Get-UPPrinter
Get-UPPrinterShareList printer share objects in Universal Print.Get-UPPrinterShare
New-UPPrinterShareCreate a new printer share for a registered printer.New-UPPrinterShare -PrinterId <PrinterID> -DisplayName “HR Printer”
Remove-UPPrinterShareRemove (unshare) a printer share.Remove-UPPrinterShare -Id <ShareID>
Set-UPPrinterShareUpdate a printer share’s settings or name.Set-UPPrinterShare -Id <ShareID> -DisplayName “Reception Printer”
Get-UPPrintJobRetrieve print jobs for a Universal Print printer.Get-UPPrintJob -PrinterId <PrinterID>
Get-UPUsageReportGenerate usage reports by user or printer.Get-UPUsageReport -ReportName dailyPrinterUsage -StartDate 2024-08-01 -EndDate 2024-08-07
Grant-UPAccessGrant user/group access to a printer share.Grant-UPAccess -PrinterShareId <ShareID> -UserId <UserID>
Revoke-UPAccessRemove user/group access from a printer share.Revoke-UPAccess -PrinterShareId <ShareID> -UserId <UserID>

Get Printer Details

  • Copy below code and run it in the PowerShell console to retrieve the ShareName, Status, Manufacturer, and Model information of all Universal Print printers.

Get Printer details

Get-UPPrinter |
     Select-Object -ExpandProperty Results |
     Select-Object DisplayName,
                 @{Name='ShareName';Expression={$_.Shares.DisplayName -join ','}},
                   @{Name='Status';Expression={$_.Status.State}},
                   Manufacturer, Model |
     Format-Table -AutoSize

Get ShareName, PrinterId and ShareId of all Printers

Get-UPPrinter |
    Select-Object -ExpandProperty Results |
    Where-Object { $_.IsShared -eq $true } |
    ForEach-Object {
        foreach ($share in $_.Shares) {
            [PSCustomObject]@{
                ShareName = $share.DisplayName
                PrinterId = $_.Id
                ShareId   = $share.Id
            }
        }
    } |
    Format-Table -AutoSize

Get and Export Printer Shares

You can retrieve all registered printer shares from Universal Print using the Get-UPPrinterShare.ps1 script and optionally export them to CSV. Open the PowerShell console as an administrator, connect to Universal Print with a Global Administrator or Printer Administrator account, and then run the script. It will return:

  • ShareID: The unique ID of the printer share.
  • DisplayName: The friendly name of the printer share.
  • Share Date: The date and time when the printer share was created.
Get and Export Printer Shares

Get and Export All Printer Assignment Details

Use the Get-UPPrinterAssignments.ps1 PowerShell script to list all printer assignments and optionally export them to CSV. Open the PowerShell console as an administrator, connect to Universal Print with a Global Administrator or Printer Administrator account, then run the script. It outputs:

  • Share Name: Printer share name
  • ShareId: Printer share ID
  • AllUserAccess: Whether the share is open to all users (True/False)
  • AllowedUser: Individual users with access
  • AllowedGroups: Groups with access
  • UserCount: Number of users with access
  • GroupCount: Number of groups with access
Get and Export All Printer Assignment Details

Grant or Revoke Access to Universal Print Printer

Use an interactive script for granting and revoking access to a Universal Print printer. You can assign a printer to either a user or an Entra security group using Grant-Revoke-Access-UPPrinter.ps1.

Grant Access Workflow

Grant Access to Universal Print Printer

Revoke Access Workflow

Revoke Access to Universal Print Printer

Get Universal Print Connector Details

To get Universal Print connector details, use the Get-UPConnector cmdlet. Copy below code and run it in the PowerShell console after connecting to Universal Print with Connect-UPService.

Get-UPConnector.ps1

$connectors = @()
$r = Get-UPConnector

if ($r.PSObject.Properties.Name -contains 'Results') { $connectors += $r.Results } else { $connectors += $r }

while ($r.'@odata.nextLink') {
    $r = Get-UPConnector -Uri $r.'@odata.nextLink'
    $connectors += $r.Results
}

$connectors |
  Select-Object @{Name='ConnectorID'; Expression={$_.Id}},
                DisplayName,
                Location,
                OperatingSystem,
                @{Name='Registered Date'; Expression={$_.RegisteredDateTime}},
                @{Name='FQDN'; Expression={$_.FullyQualifiedDomainName}} |
  Format-Table -AutoSize
Get Universal Print Connector Details

Troubleshooting

You may encounter an error message while using the Connect-UPService cmdlet, which is used to connect to Universal Print. The example below shows an error generated in the PowerShell console. The authentication fails because MFA could not be completed. Closing the current PowerShell session and starting a new one has resolved this issue for me.

00000003-0000-0000-c000-000000000000
Connect-UPService : One or more errors occurred.AADSTS50076: Due to a configuration change made by your
administrator, or because you moved to a new location, you must use multi-factor authentication to access
'00000003-0000-0000-c000-000000000000'. Trace ID: 93537e72-20c8-4347-bba8-31cbb5437600 Correlation ID:
02487690-e536-41f3-8435-0c608e3b9178 Timestamp: 2025-08-10 07:04:55Z
At line:1 char:1
+ Connect-UPService -UserPrincipalName [email protected]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : AuthenticationError: (:) [Connect-UPService], FailedCmdletException
+ FullyQualifiedErrorId : Microsoft.UPManagement.Cmdlets.ConnectService

Leave a Comment