Deploy Printers with Intune
This page covers two ways to get printers onto Windows devices managed by Microsoft Intune: PowerShell scripts that connect to a shared printer on a print server, and Universal Print through an Intune policy.
What was and was not tested
The PowerShell on this page was checked against the cmdlet reference pages on Microsoft Learn, listed under Sources. None of the scripts were executed when this page was revised, on a print server or on an Intune-managed device. Treat them as starting points and test them on a pilot device before assigning them widely. Where a behavior is not documented on Microsoft Learn, the text says so.
Connect to a Shared Printer from PowerShell
The Add-Printer reference on Microsoft Learn documents this form for a network printer connection, using the print server name and the shared printer name:
# Placeholder server and printer names
Add-Printer -ConnectionName "\\PrintServer\PrinterName"
In the -ConnectionName form, Add-Printer takes the connection name and no other printer parameters in Learn’s syntax. It does not take a -DriverName. -DriverName and -PortName belong to a different form of the command, which creates a printer from a driver and a port. Learn also says you may need administrative credentials to run Add-Printer.
Intune Platform Script
PowerShell Script: Connect a Printer
Intune platform scripts have no field for script arguments in the settings Learn describes (script location, logged-on credentials, signature check and 64-bit host). Set the printer path inside the script instead of using a param block.
# Placeholder value. Replace it with your print server and shared printer name.
$PrinterPath = "\\PrintServer\PrinterName"
try {
Add-Printer -ConnectionName $PrinterPath -ErrorAction Stop
Write-Output "Printer connection added: $PrinterPath"
exit 0
}
catch {
Write-Output "Error: $($_.Exception.Message)"
exit 1
}
This script has no check for an existing printer. An earlier version of this page used Get-Printer -Name with a connection path. Learn documents Get-Printer -Name with the name of a printer, such as “Microsoft XPS Document Writer”, and does not show it being used with a \\server\printer connection path, so that check was removed. Learn also does not say what Add-Printer -ConnectionName does when the connection already exists. Test that case on a pilot device. Learn says a platform script does not run again unless the script or policy changes, apart from retries after a failure.
Make a Printer the Default
Earlier versions of this page used Set-PrintConfiguration -Datatype "RAW" and wrote a Device value under HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows. Both were removed:
Set-PrintConfigurationhas no-Datatypeparameter in its Learn syntax. It sets configuration such as collation, color, duplexing mode and paper size.-Datatypeis a parameter ofAdd-PrinterandSet-Printer, and changing the data type is not needed to set a default printer.- Setting the default printer by writing that registry value is not documented on Microsoft Learn, so it is not recommended here.
The PrintManagement cmdlets on Learn do not include one for setting the default printer. Microsoft Learn documents the SetDefaultPrinter method of the Win32_Printer WMI class, which sets the default printer for the user calling the method. This is one way to call it from PowerShell:
# Placeholder printer name. Win32_Printer lists a connected network printer by its Name.
$PrinterName = "\\PrintServer\PrinterName"
$Printer = Get-CimInstance -ClassName Win32_Printer | Where-Object { $_.Name -eq $PrinterName }
if (-not $Printer) {
Write-Output "Printer not found: $PrinterName"
exit 1
}
$Result = Invoke-CimMethod -InputObject $Printer -MethodName SetDefaultPrinter
if ($Result.ReturnValue -ne 0) {
Write-Output "SetDefaultPrinter returned $($Result.ReturnValue)"
exit 1
}
Write-Output "Default printer set: $PrinterName"
exit 0
Because the method sets the default for the calling user, run this script as the signed-in user, which means Run this script using the logged on credentials set to Yes in the Intune script settings. Learn documents the SetDefaultPrinter method and the Invoke-CimMethod cmdlet separately. The combined script above was not run, and Learn does not show the printer Name value for connected network printers, so confirm it with Get-CimInstance -ClassName Win32_Printer on a test device.
Deploy via Intune
Step 1: Create the Script
- In the Microsoft Intune admin center, go to Devices > Scripts and remediations > Platform scripts.
- Select Add > Windows 10 and later.
- On Basics, enter a name. On Script settings, upload the script.
Script settings from Learn that matter for printers:
- Run this script using the logged on credentials: Yes (the default) runs the script with the user’s credentials. No runs it in the system context.
- Run script in 64-bit PowerShell host: the default is No, which runs the script in a 32-bit PowerShell host.
- The script must be less than 200 KB, and scripts time out after 30 minutes.
Step 2: Assign to Groups
Assign the script to Microsoft Entra user or device security groups. Learn says the Intune management extension checks for new scripts after every reboot. The script runs once and does not run again unless the script or policy changes. If the script fails, it is retried three times at the next three consecutive check-ins.
Printer Driver Management
# List installed printer drivers
Get-PrinterDriver
# Install a printer driver by its driver name (requires administrator credentials)
Add-PrinterDriver -Name "Driver Name"
Get-PrinterDriver does not need administrator credentials. Add-PrinterDriver installs a driver by name and needs them. In Learn’s syntax it also accepts an -InfPath parameter.
Windows also has pnputil. Learn documents pnputil /add-driver <filename.inf> /install as a command that adds driver packages to the driver store, available starting in Windows 10 version 1607, run from an elevated prompt:
# Placeholder INF file name
pnputil /add-driver printer.inf /install
The pnputil page describes the driver store and matching devices. It does not cover registering a printer driver for use by Add-Printer, so confirm on a test device that the driver name then appears in Get-PrinterDriver.
Troubleshooting
# Inspect service state, printers and queued jobs first
Get-Service -Name Spooler
Get-Printer
Get-PrintJob -PrinterName "PrinterName"
# Restarting the spooler interrupts active print jobs. Only after confirming an
# outage and notifying affected users, use an approved maintenance window.
# Restart-Service -Name Spooler -WhatIf
Get-PrintJob takes a printer name and does not accept wildcards. Get-Printer does not need administrator credentials. For platform script failures, Learn says to review the Intune management extension logs. They are typically in C:\ProgramData\Microsoft\IntuneManagementExtension\Logs, and AgentExecutor.log in that folder tracks PowerShell script executions. See AppWorkload.log and IME logs for how to read the IME logs.
If printer scripts fail during provisioning on new devices, run the free Pre-Check Lite today to rule out Device Preparation configuration problems before you rework the printer package.
Universal Print
Universal Print is a cloud print service in Microsoft 365 that, with Universal Print-compatible printers, does not require any on-premises infrastructure. Intune deploys Universal Print printers with a settings catalog policy, not with a script. The steps below follow the Learn article “Create a Universal Print policy in Microsoft Intune”:
- Register each printer in the Universal Print service. You need three values for each printer from the Universal Print portal: the Cloud Device ID (printer ID), the Printer Shared ID and the Printer Shared Name.
- In the Microsoft Intune admin center, go to Devices > Manage devices > Configuration > Create > New policy.
- Select Windows 10 and later as the platform and Settings catalog as the profile type.
- In Configuration settings, select Add settings, pick Printer Provisioning in the settings picker, and set Action to Install. Enter the Cloud Device ID, Printer Shared ID and Printer Shared Name. Use Add for more printers.
- In Assignments, assign the profile to users. Those users need a Universal Print license and access rights to the printer and the Universal Print service. Learn says Intune grants the permissions to the assigned users or groups if they do not already have them.
Requirements and limits from Microsoft Learn:
- The Universal Print CSP is available on Windows 11 and on Windows 10 with the July 2022 cumulative update (KB5015807) or later.
- The integration is designed for one user per device and for Azure Virtual Desktop. Shared Windows devices outside Azure Virtual Desktop are not officially supported.
- The older PrintProvisioning tool and
printers.csvprocess are deprecated. - Learn lists Error 0x8007007f (ERROR_PROC_NOT_FOUND) as a common error and says to confirm the Windows version is supported.
Licensing, printer registration, the Universal Print connector for existing printers and the Universal Print troubleshooting guide are not covered here. See Set up Universal Print and the Universal Print policy article on Microsoft Learn.
Sources
Pages read on Microsoft Learn while revising this article:
- Add-Printer
- Get-Printer
- Get-PrinterDriver
- Add-PrinterDriver
- Get-PrintJob
- Set-PrintConfiguration
- SetDefaultPrinter method of the Win32_Printer class
- Invoke-CimMethod
- PnPUtil command syntax
- Use PowerShell scripts on Windows devices in Intune
- Create a Universal Print policy in Microsoft Intune
- Intune management extension for Windows
- Universal Print printer provisioning