In this post, you will learn how you can utilise Microsoft Intune to deploy local network printers and their associated drivers to your managed devices.

This technique will utilise Intune application deployment and PowerShell to deliver the drivers to the device and add the printer with its configured network details. 

This makes this technique an effective method of deploying printers to end-user devices in environments where there are no servers to host print servers, and no other print management functionality is in place.

Collecting Printer Drivers

The first step you will need to complete is to gather the drivers for the printer(s) that you want to install. These are normally available from the printer’s vendor website and can be found by searching for the printer’s model number.

These often come as a zip folder containing all of the required files, Or in some cases, they come in an exe format which will extract the required files to a chosen location.

Printer Driver
https://support.hp.com/id-en/drivers/hp-universal-print-driver-series-for-windows/model/3271558
Canon Printer Driver
https://www.canon.co.uk/support/consumer/products/printers/i-sensys/lbp-series/i-sensys-lbp673cdw.html?type=drivers&os=Windows%2011

Extract the contents of the driver package to a unique location for this printer install and then remove any files that aren’t needed, for example, if a driver package has both a 32-bit and 64-bit version, remove the files for the version you do not require. If you are unsure, however, leave the files as they are.

Once you have only the required files the next task is to take note of what the driver itself will be called after it is installed (not just the name shown on the website). In some cases such as the Canon PCL 6 driver, this will be listed in the .inf file which can be opened in Notepad

If this is not shown in the .inf file (as this will not also be present) then another method is to get this during the driver selection process. To accomplish this open device manager, right-click any printer and select ‘Update Driver’.

Then select “Browse my computer for drivers” and then select “Let me pick from a list of available drivers on my computer”.

From this page select the “Have Disk…” button, and then browse from the new window and navigate to your chosen driver’s .inf file, once selected press “Ok”.

Once you have selected your driver’s .inf file you will be taken back to the select a driver page, and the selected driver’s name will be displayed in the printer list. Take note of the name of the driver at this stage as this will be needed for the script.

Other Prerequisites

Now that you have the driver’s files and the name of the driver you are installing you need to collect 2 more pieces of information, these will be required for the install script so need to be gathered before packaging and uploading to Intune.

The first is the IP address of the printer that you are looking to deploy, this will be used in the port that will be created for this printer. Something to consider at this stage is to ensure your printer is on a Static or reserved IP address, if this is not the case you will lose connection to the printer.

Next is simply the name that you want to be used for the printer once it has been installed. This will be used for naming the printer and the port that it uses.

The Install Script

Now that you have the required information you can adjust the install script which will be used to perform the installation through Intune. The script for installing the printer can be found below, alternatively, this can be found on Github:

Intune – Install Printer.ps1

The script itself is broken down into 4 stages::

  • Add the selected driver to the driver store and collect the name it gets published with (e.g. “oem50.inf”)

  • Add the selected driver as a printer driver using the published name

  • Add the printer port using the printers name and IP address if it doesn’t exist already

  • Create the printer using the driver, printer port, and printer name if it does not exist already

Using the information collected in previous stages you will need to adjust the first few lines of the script.

  • $Drivername (ln2):
    Replace this with the name of the driver collected from the .inf file or device manager

  • $PrinterName (ln3): 
    Replace this with the name of the printer that you want to be used once the printer is installed

  • $PrinterIP (ln4):
    Replace this with the Static or reserved IP address of the printer

  • $INFSource (ln5):
    Replace this with the path to the INF file within the folder you created for this. As this will be running from the script package on managed devices it would be best to use $PSScriptRoot + “.\[path to the INF file]”

    For example:
    $PSScriptRoot + “\x64\Driver\CNP60MA64.INF”

The script will also create a file in the Intune logs location to indicate that the printer was created successfully. This is so that you can create a simple detection rule to confirm the printer was installed. 

Once you have updated the variables in the install script you should save the script into the folder you have stored your driver file in. The script should have an appropriate name as you will need to remember this when uploading this in Intune.

Package Your Files

Now that you have made the required adjustments to the install script you will then have to use the Win32 Content Prep Tool to package the driver and install script as a .IntuneWIN file. If you do not have this on hand already you can download this from GitHub using the link below

Microsoft Win32 Content Prep Tool

Once downloaded simply open the file to start the process, once open you will be prompted for 4 inputs:

  1. Specify the source folder:-
    Enter the path for the folder that you saved the driver files and install script in, in the below example this is ‘C:\Intune\Printer Install’

  2. Specify the setup file:-
    Enter the full path of the file used to perform the install, normally this would be a .exe or .msi file, however in this example this will be the full path to the install script that was created in the previous step (you can get this by right clicking the script and selecting ‘Copy Path’)

  3. Specify the destination folder:-
    This is the folder the .IntuneWin file this process creates will be placed once created, this can be anywhere on your device, however for ease of access I advise selecting the same folder the drivers are currently residing in (same as step 1)

  4. Do you want to specify a catalog folder?:-
    For this we will enter ‘N’ as it is not required for this process, however If you are providing this to devices running in Windows 10 S Mode (or SE), this will be a requirement.

Once this is done you will then have a .IntuneWin file in the destination folder that you specified in the Prep tool, and you can move on to the next stage

App Package and information

After you have packaged the driver files and the installation script as a .IntuneWin file you are ready to upload this into Intune. Once on the Windows Applications page select the “Add” button, change “App Type” in the section on the right to “Windows App (Win32)” and press “Select” to continue.

The first thing you need to provide is the app name and description as by default this will just show the name of the Setup file you selected in the prep tool. Make sure to use a name and description that makes it easy to understand what it is for so that others can understand its purpose should look at it. 

(The name and description are also shown in the company portal if you make this app available to end users, so even more reason to enter a clear description)

The other required field is the publisher field, here you can either enter the app name this is required for (if it is for an app) or your company name. Fill in the rest of the fields as you see fit and select next.

App Install Commands

On the next page you will be prompted for the install and uninstall command, the install command for this is:

powershell.exe -ExecutionPolicy Bypass -File “Intune – Install Printer.ps1”

You will need to adjust the filename in the command if you changed the name of the script when adjusting it in previous steps.

In this example, an uninstall command is not required and therefore the install command has been pasted into the uninstall command box. However, you could add a command to remove the install printer by using a command like the one below:

powershell.exe -command “Remove-Printer ‘Canon Test Printer'”

You will have to replace the printer name with the name of the printer you are going to install

Once you have entered the install and uninstall commands, change the “Allow Available Uninstall” to “No”, and then leave the install behaviour as “System” so that the drivers can be installed. Once this is done you can move onto the next page.

Requirements

Next is the requirements page, here you will be prompted for the requirements for the deployment. As this is a script to install a printer the requirements do not apply and therefore any setting is applicable.

One this to consider however is that if you have chosen to select a 64-bit driver to install for your printer, you may also want to limit this to 64-bit devices.

Detection Rule

After you have finished configuring the requirements page you can move on to the Detection rules. For this we want Intune to look for the .log file created on the successful completion of the install script.

Select to manually configure detection rules and then select “Add”. In the section on the left change the “Rule Type” section to “File”, and then set the following values:

Path:
C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\

File or Folder:
[Printername] Deployment Successful.log

Detection Method:
File or folder exists

Make sure that the file name used uses the same printer name that you used in the script as this will determine the name of the log file, this was done to differentiate deployments of multiple printers.

Once you have configured the detection rule you can move on to the next pages, these are dependencies and supersedence. In this example I will not be using either of these however you can configure them if required.

Assignments and final steps

The final step is to configure the assignments for your printer deployment, here you will select the groups of users or devices that you are going to be deploying this printer to.

When selecting which groups you want to deploy this to you have two deployment options. The first is to make this a required deployment, meaning all assigned users and devices will have this deployed.

The second option is to assign this as “Available for enrolled devices”, this option will make it so that the application will appear as an option for the end user through the company portal, from there they can install the printer if they need it. This can be a good option for printer deployments as users can pick and choose the printers they need on their device.

You can also change some of the assignment settings on the selected groups by clicking on the text under the ‘End user notifications’ or ‘Availability’ column. This allows you to adjust what notifications will be shown to the end user once the installation takes place, as well as specify an install date for the application in case you do not want this to be installed immediately

Once your assignments are sorted you can move on to the final step which is to review your current settings, this will allow you to give everything you have set so far a once-over to ensure that everything is correct. If you are happy that this is ready to go, select Create at the bottom of the page

As with any application deployment be careful not to close the window in which you are configuring the application immediately after you have selected the “Create” option. 

This is because the .IntuneWIN file you created will not start to upload until after you have saved the configuration, if you close the window before this upload completes it will fail the upload, which in turn causes the application to become unusable.

The upload itself normally only takes a minute or 2 (depending on the size of the app package) and a notification will be shown on the top right of the page once the upload has completed.

Considerations

The application will then proceed to install to devices included in your set assignments when they next check-in, or if you have dependencies set, when Intune has confirmed the required applications have been installed on the system. 

Bear in mind that a device check-in can take some time depending on its up time, the quickest way to get this to occur is to either select ‘Sync’ in the company portal app (or from the Device management page in Intune) or to restart the device as this will make the device check in every 5 minutes for 15 minutes after the restart.

The log files for the installation can also take a little while to show in Intune, sometimes up to an hour after the installation has run before they show in the portal. Installation failures can occur for various reasons, and the logs will show an unknown error if the issue is with the PowerShell script.

The script itself should only fail if there is an issue with the selected .inf file (i.e. cannot be found) or if the name selected for the driver is incorrect (i.e. it was not listed in the .inf file). So if you are having failures with the script that would be the first place to look.

When entering the printer details you will need to know the Printer’s IP address on the network local to the device that you are deploying, something you will have to check prior however is whether IP address for that printer is static or reserved in DHCP. If this is using DHCP of some variety and the IP address changes this installation will be ineffective as the printer location will not adjust according to the printer’s new IP when it changes.

Another consideration would be to check the size of the packaged drivers that you are uploading to the device as the more driver files included in your package, the more likely you will run into disk space issues on the device. To avoid your installation from using up what remaining storage a device might have, consider adding an available storage check on your application package in the requirements section.

Doing so will prevent the package from attempting to install if the device does not have the amount of storage you specify available, which in turn should prevent this from accidentally consuming what space the device has left and causing further issues.

Summary

There are many considerations that have to be made when moving workloads and services into the cloud, one of these, especially when trying to transition into a serverless environment is how to deploy network printers.

While there are many cloud printing solutions that can be used, these can often be cumbersome and may not be worthwhile in environments that only have a few printers that need to be deployed.

In these scenarios it can be very useful to be able to push out the printers and their associated drivers to your managed devices using an Intune Application Package, to spare your administrators from having to perform this task on each device manually. Or going through the process of configuring a print management solution for just a few printers.

Author: Curtis Cannon

My name is Curtis, I am a service engineer for an MSP. My focus is on specialising on Azure/Entra ID and other related cloud technologies found in the Microsoft 365 Suite. This content has been written from my own knowledge on the subject in question, and any opinions given throughout the post are mine and do not represent the opinion of others.

Related Posts