Deila með


Universal Print PowerShell module

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.

Installing UniversalPrintManagement

Run the following command from a PowerShell session:

Install-Module UniversalPrintManagement

By default, the PowerShell gallery isn't configured as a trusted repository for PowerShellGet. The first time you use the PSGallery you will 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.

Note

For additional information about installing PSGallery modules in offline scenarios, refer to the PowerShell Gallery.

Uninstalling UniversalPrintManagement

Run the following command from a PowerShell session:

Uninstall-Module -Name UniversalPrintManagement

Sign in to Universal Print

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.

Note

The main purpose of this cmdlet is to allow non-interactive sign in for automated scripts. This can be done, for example, using Connect-UPService -UserPrincipalName username@tenantname.com -Password $variableHoldingSecureString syntax and retrieving the password from a secure storage.

Once signed in, use the available cmdlets in the module to access and manage printer resources.

UniversalPrintManagement Cmdlets

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). Nouns in UniversalPrintManagement always start with the prefix UP.

Knowing the nouns and verbs help you find commands with the Get-Command cmdlet. For example, to find commands that use the Get verb:

Get-Command -Verb Get -Module UniversalPrintManagement

To get cmdlet details with examples:

Get-Help Get-UPPrinter -Detailed

[NOTE] The UniversalPrintManagement Get cmdlets now return results with continuation tokens to allow paging through large collections and retying failed requests. Learn how to use continuation tokens. Due to the model change required to accomodate for continuation tokens, it is now recommended to store Get cmdlet results in a variable and access them via .results. See examples here.

Sign-in

Cmdlet Description
Connect-UPService Connects with an authenticated account to use for Universal Print cmdlet requests.

Printers

Cmdlet Description
Get-UPPrinter Use this cmdlet to get information about a single or list of printers.
Remove-UPPrinter Use this cmdlet to unregister printers.

Printer Properties

Cmdlet Description
Set-UPPrinterProperty Use this cmdlet to update mutable properties of a printer.

Printer Shares

Cmdlet Description
New-UPPrinterShare Use this cmdlet to share a printer.
Get-UPPrinterShare Use this cmdlet to get information about a single or list of shared printers.
Remove-UPPrinterShare Use this cmdlet to unshare printers that have been shared earlier.
Set-UPPrinterShare Use this cmdlet to update a printer share to swap a registered printer due for maintenance with a working one.

User Permissions

Cmdlet Description
Grant-UPAccess Use this cmdlet to grant print access to a user or group or all users in the organization.
Revoke-UPAccess Use this cmdlet to revoke print access from a user or group or all users in the organization.
Get-UPAllowedMember Use this cmdlet to get information about users and groups that have print access to a specific printer.

Connectors

Cmdlet Description
Get-UPConnector Use this cmdlet to get information about a single or list of connectors.
Remove-UPConnector Use this cmdlet to unregister connectors.

Connector Properties

Cmdlet Description
Set-UPConnectorProperty Use this cmdlet to update mutable properties of a connector.
Cmdlet Description
Get-UPPrintJob Use this cmdlet to get information about print jobs that were sent to a printer.
Cmdlet Description
Get-UPUsageReport Use this cmdlet to get different types of print usage reports.