🖨️ Deploying Printer Drivers and Mapping Printers via Intune: What You Need to Know
Managing printers through Microsoft Intune can be tricky — especially when trying to automate driver installation and printer mapping using Win32 app packaging. While scripts that work perfectly on a local test machine often fail once deployed via Intune, understanding why this happens is key to troubleshooting.
This post summarizes a common scenario discussed in the sysadmin community and provides a deeper explanation of the issue along with guidance on how to fix it.
🧩 The Scenario
An admin attempted to automate printer deployment across endpoints using Intune. The process worked fine when executed manually but failed when deployed as a Win32 app through Intune.
Their setup involved two main components:
- A Batch File (
.bat)
Handles file copying and script execution.xcopy ".\PrinterFiles" "C:\Temp\Printer" /E /Y PowerShell.exe -ExecutionPolicy Bypass -File "C:\Temp\Printer\InstallPrinter.ps1" - A PowerShell Script (
InstallPrinter.ps1)
Installs the printer driver, adds the printer port, and sets a default printer.cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs -a -m "DriverName" -i "C:\Temp\Printer\Driver.inf" cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r "IP_10.10.10.20" -h "10.10.10.20" -o raw -n 9100 cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -a -p "OfficePrinter" -m "DriverName" -r "IP_10.10.10.20" (Get-WmiObject -Class Win32_Printer -Filter "Name='OfficePrinter'").SetDefaultPrinter()
Manually running these scripts on a test machine successfully installed and mapped the printer. However, deployment via Intune consistently failed.
⚙️ Why Manual Install Works but Intune Deployment Fails
When deploying through Intune, there are environmental and execution differences that often cause these issues.
1. Execution Context
Intune runs Win32 apps under the System account, not the logged-in user.
- System context doesn’t have access to user profiles or mapped drives.
- If the script tries to install a printer for a specific user, it may silently fail.
✅ Fix: Run the PowerShell installer in user context by setting the “Install behavior” to User in the Intune app configuration.
2. File Path Issues
Intune extracts Win32 app files to:
C:\Program Files (x86)\Microsoft Intune Management Extension\Content
If the script assumes paths like C:\Temp\Printer, file copying or execution might fail.
✅ Fix:
Use dynamic paths within the script:
$PSScriptRoot
This ensures relative file paths resolve correctly during Intune deployment.
3. Driver Installation Permissions
Printer driver installation requires elevated permissions. The Add-PrinterDriver and prndrvr.vbs commands can fail if the driver catalog isn’t trusted or if Windows SmartScreen blocks it.
✅ Fix:
- Use signed drivers from trusted vendors.
- If possible, preload drivers in Windows via PnPUtil or deploy them using Driver Store Injection before mapping printers.
4. Missing Dependencies or Incorrect Packaging
If the .inf, .cat, or .dll files aren’t packaged properly in the .intunewin file, Intune can’t install the driver during execution.
✅ Fix:
Repackage the app using the Microsoft Win32 Content Prep Tool:
IntuneWinAppUtil.exe -c "SourceFolder" -s "Install.bat" -o "OutputFolder"
Test your .intunewin package locally by extracting and running it manually in System context using:
psexec -i -s cmd.exe
🧠 Community Recommendations
A user linked to a helpful post from MSEndpointMgr on installing network printers using Intune and PowerShell:
🔗 Install Network Printers with Intune Win32 Apps & PowerShell
That guide suggests a cleaner PowerShell-only approach:
- Store the printer’s configuration details (driver, port, printer name) in variables.
- Run PowerShell directly from the Intune app (no batch file).
- Use detection rules to check if the printer already exists.
🧰 Example: Simplified Intune-Friendly Script
Here’s an adapted version that works well with Intune deployments:
$PrinterName = "OfficePrinter"
$PortName = "IP_10.10.10.20"
$DriverName = "HP Universal Printing PCL 6"
$IPAddress = "10.10.10.20"
# Add TCP/IP port if not present
if (-not (Get-PrinterPort -Name $PortName -ErrorAction SilentlyContinue)) {
Add-PrinterPort -Name $PortName -PrinterHostAddress $IPAddress
}
# Install printer driver
Add-PrinterDriver -Name $DriverName
# Add printer
if (-not (Get-Printer -Name $PrinterName -ErrorAction SilentlyContinue)) {
Add-Printer -Name $PrinterName -DriverName $DriverName -PortName $PortName
}
# Set as default
Set-Printer -Name $PrinterName -IsDefault $true
Detection Rule Example:
- Rule type: Script
- Logic: Check if the printer exists
Get-Printer -Name "OfficePrinter" | Out-Null
🧩 Best Practices for Printer Deployment via Intune
- Use PowerShell-only deployments when possible. Avoid
.batwrappers. - Run in user context if you need per-user printers.
- Preload drivers or use signed packages.
- Add detailed logging for troubleshooting:
Start-Transcript -Path "C:\ProgramData\PrinterInstall.log" - Test in System context before pushing to production.

