Sample script to map additional fields to Universal Print attributes.

Iron Contributor

Unfortunately, the Universal Print Connector doesn't upload fields from the on-premises object, such as location and comments. Likely this is because "location" is now represented as a dozen attributes in Azure.

 

At some point, someone should look all this detail up and populate the attributes properly, but it won't be me and it won't be today. :) For now, I chose to map the fields as follows, but you can obviously adjust this as necessary:

 

on-prem "Location" = cloud "Site"

on-prem "Comment" = cloud "Room Description"

 

To work around this, I wrote up this simple script, which might be helpful to others.

 

NOTE: There are several ways to do this, but I like the join-object cmdlet, so be sure to install that first.

 

 

 

 

 

Install-Module UniversalPrintManagement
Install-Module join-object 

#Run from the print server:

$OnPremPrinters = Get-Printer 

Connect-UPService 

$CloudPrinters = Get-UPPrinter

$Merge = Join-Object -Left $OnPremPrinters -LeftJoinProperty Name -Right $CloudPrinters -RightJoinProperty name -Prefix Cloud_

foreach ($printer in $Merge) {
    Set-UPPrinterProperty -PrinterId $printer.Cloud_PrinterId -Site $printer.Location -RoomDescription $printer.Comment
}

 

Untitled.png

0 Replies