Share via


Universal Print PowerShell modules

You have two options to manage Universal Print from PowerShell:

  • Use the UniversalPrintManagement module, which provides the easiest way to accomplish common management tasks. While the commands are easier to use, some advanced functionality that's available in the Microsoft Graph API might be missing.
  • Use the Microsoft Graph Powershell SDK, which allows the entire Microsoft Graph API to be scripted against in PowerShell. The commands are lower-level, so they may not be as easy to use for simple tasks.

Documentation for both approaches is provided below. Switch between examples to see the major differences.

Get started

Prerequisites

  • Upgrade to PowerShell 5.1 or later
  • Update PowerShellGet to the latest version using Install-Module PowerShellGet
  • The PowerShell script execution policy must be set to RemoteSigned or a lower restriction level using Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser. Read more about restriction levels.

Step 1: Install the PowerShell module

# To install for all users (must be administrator), remove -Scope CurrentUser
Install-Module UniversalPrintManagement -Scope CurrentUser

This command will acquire the requested module from the PowerShell Gallery, which isn't configured as a trusted repository for PowerShellGet by default. The first time you run this command, you may see the following prompt:

Untrusted repository

You are installing the modules from an untrusted repository. If you trust this repository, change
its InstallationPolicy value by running the `Set-PSRepository` cmdlet.

Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

Answer Yes or Yes to All to continue with the installation.

Step 2: Connect to Universal Print

Now that you have the module installed, you need to connect to Universal Print before you can run any commands.

# To provide authentication details interactively using a system authentication prompt:
Connect-UPService

# To provide authentication details non-interactively:
# Connect-UPService -UserPrincipalName username@tenantname.com -Password $variableHoldingSecureString

Step 3: Verify configuration by getting a list of your printers

To make sure everything is set up correctly, try getting the list of printers registered with your tenant. For a full list of available commands, see Command reference.

Get-UPPrinter

Update or uninstall

Update the PowerShell module

Update-Module UniversalPrintManagement

Uninstall the PowerShell module

If you need to uninstall the module later, use this command:

Uninstall-Module -Name UniversalPrintManagement