Printer deployment with Intune is not always easy. In larger environments you probably still have a Windows Print Server using printer shares. Connecting them is usually done via PowerShell scripting or Win32 Apps in Intune.
This solution is for those environments where you have no Windows Print Server and no Cloud Printing solution available. Just a bunch of clients and a bunch of IP printers. Getting the drivers installed can be a cumbersome task, especially if there are many different types of printers and default settings. I have done this in the past at clients where there was no better way.
Sometimes you find out a very old solution to help doing something new. This year I did a migration project involving an RDS server to be migrated to AVD. This RDS server was loaded with printers and it triggered me to find a method of export/import them. I found out this was built in to Windows (and it has been for a while). Using the Print Management tool you can Export/Import local printers that are installed on the server/client. This even worked in my project migrating from RDS running Windows Server 2019 to AVD running Windows 11. I actually scripted the import of the printers so I could roll out new AVD sessionhosts very quickly. Installing these printers helped a lot in the project.
This actually describes how to deploy printers via scripting. You can use it in Intune, Nerdio or other scripting deployments of clients. In this blog I will create a Win32 app for Intune deployment to you Intune managed clients.
List of printers used in this blog.
Printer brand/type | Name | Driver | IP number |
HP Color LaserJet Pro MFP M183fw | Printer_1st_floor | upd-pcl6-x64-7.2.0.25780 | 10.95.50.24 |
Kyocera ECOSYS M3040dn | Printer_2nd_floor | KX Universal Printer Driver (v.8.1.1109) | 10.172.67.12 |
Prepare a clean Windows 11 installation, can be a laptop or in a Virtual Machine. Install all the IP printers you need in your environment that you want to deploy in one go. Configure all settings, like paper size, paper sources etc. Also don’t forget to test each of them if they actually work.
Export the printer(s)
In Windows 11 click start button and type: Print Management:
Browse to, Print Servers, <ComputerName>, Printers, here you will see your installed printers:
Next, rightclick on the <ComputerName> in my screenshot the name is W11-CLEAN, choose “Export printers to a file…”
As you can see in the screenshot, only the two installed printers are to be exported, the built in PDF printer is not included.
Follow the wizard and save your file somewhere.
Create Intune Package
Create your favorit Intune Package folder structure. I often use this:
Put the .printerExport file in the _Package folder, and create a new PowerShell script in the same folder “Deploy_printers.ps1”
<#
Deploy_printers.ps1 - 20240929 - www.microcloud.nl
#>
$printerExportFN="PrinterExport-2024.printerExport"
$path="c:\programdata\BloglabHUB\Printerdeployment\" # End with an: \
If(!(test-path -PathType container $path))
{
New-Item -ItemType Directory -Path $path
}
Copy-Item $printerExportFN -Destination $path
$printbrm="c:\Windows\System32\spool\tools\PrintBrm.exe"
$arguments=" -r -f "+$path+$printerExportFN
Start-Process -NoNewWindow -FilePath $printbrm -ArgumentList $arguments
Next create another new PowerShell script in the same folder “Remove_printers.ps1”
<#
Remove_printers.ps1 - 20240929 - www.microcloud.nl
#>
$printerExportFN="PrinterExport-2024.printerExport"
$path="c:\programdata\BloglabHUB\Printerdeployment\" # End with an: \
# Remove printers from system
remove-printer "Printer_1st_floor"
remove-printer "Printer_2nd_floor"
# Remove import file
$RemoveFN=$path+$printerExportFN
Remove-Item -Recurse -Force $RemoveFN
Create the package
Start “IntuneWinAppUtil.exe”
Type/paste in the answers to the questions from “IntuneWinAppUtil.exe”:
Upload the package into Intune
Login to https://intune.microsoft.com with the permissions to add a new Win32 application.
Go to Apps/Windows/Add.
Change app type to: Windows app (Win32), click select.
Click select app package file:
Browse to the “Deploy_printers.intunewin” file created in the previous step, click OK.
Fill in the required options and choose a name, logo etc. click next when ready.
Enter these two commands:
Install: powershell.exe -executionpolicy bypass -file deploy_printers.ps1
Uninstall: powershell.exe -executionpolicy bypass -file remove_printers.ps1
Set the requirements for this package:
Add detection rule “Manualle configure detection rules”, click add, rule type: file and fill in the parameters.
For this blog I skip dependencies and supersedence. For test purpose set the app Available to the group you want. For this blog I choose “Add all users”.
Click create
When the package is uploaded and created you can login to your test machine and see if it works. In the Company Portal you should see the new Win32 app “Deploy_printers.ps1”.
Click Install to test the installation.
After the installation you will see the two printers that came from the clean source machine installed on the client.
It is now up to you how you want to deploy these. You can change the name, add a nice icon and have users install the printers manually from the company portal. Or you can set the package to required so that the printers get installed automatically on all targeted clients.