How to Install Printer Drivers and Printers from Intune using Win32

The printing solution that a business uses is integral to its operations and can either positively or negatively affect productivity. It’s important to ensure that you can get the maximum benefits from your IT infrastructure. A key component of any printing solution requires proper printing setup.

But it’s not always as easy as we’d like it to be, especially with so many different products and services available on the market. IT admins need to choose wisely so that businesses can implement tailor-made solutions to address the needs of their employees.

Today, we’ll be going over how you can take advantage of Win32 for the installation of Printer Drivers and Printers, making light work of printing setup and execution.

Importance of printing solutions

Technology has come on in leaps and bounds over the last few decades and has made a massive impact on how companies do business. A lot of the products and services we now have allow us to conduct business in ways that most people couldn’t imagine just a decade ago.

But, even with all our mobile devices and remote working solutions, the simple printer still plays a very big role for most businesses. Plenty of business deals and various transactions still require us to have physical documents, and these can include contracts, proposals, various legal documents, and more. Although businesses can do their printing elsewhere, it’s easier and more cost-effective to have in-house printing solutions. This, of course, requires printing setup and ongoing infrastructure maintenance.

It also offers greater security for highly sensitive documents. Another potential benefit is increased productivity. With the capabilities of modern printing setup and solutions, anyone needing to print documents can do so from anywhere in the office using their PC or even mobile device. This cuts down on time that could otherwise be wasted going to print documents.

Furthermore, having your own in-house printing solution helps you to create a reproducible standard for all materials that your business needs to print. So, all your letterheads, business cards, contracts, etc., will all have a standard look and feel that every professional business wants to have. With that said, let’s look at how you’ll be able to add printers and printer drivers to your business.

Adding a Printer to Windows

When trying to add a new printer to your Windows setup, you’ll need to follow a few steps to ensure that the installation is seamless. Admins may often encounter issues, such as failing to remove the printer from the system, incomplete uninstallation, and failure to install new drivers, among other things.

You may also experience errors like “This driver is not fully installed”. By utilizing certain commands, you can make your printing setup task a bit easier and reduce the chances of facing these problems. In this section, we’ll be going over the steps that you need to follow.

WHAT IS POWERSHELL?

Let’s start by going over what PowerShell is before discussing the steps for adding a printer to Windows. According to Microsoft:

PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework.”

Just about anyone who wants to use this solution can since it was built to run on Windows, macOS, and Linux, as well. By using this tool, administrators, developers, and DevOps professionals will be able to use code to easily automate tasks and configurations. Moreover, you can use it either as an open-source shell or a scripting language.

PowerShell offers you the following areas of functionality:

  • Command-line interface – accepts and returns .NET objects, unlike other shells that will only accept and return text. This interface enables PC users to directly interact with the computer through text, unlike the GUI most others use.
  • Scripting language – PowerShell is not just a scripting engine. It’s also a fully functional scripting language that you can use to automate various tasks for DevOps, user management, continuous integration/continuous development, and many other system administrator tasks.
  • Automation platform – because of how extensible PowerShell is by design, this allows an ecosystem of PowerShell modules to deploy and manage almost any technology you work with. And these cover a wide range of Microsoft services, such as Azure and Windows, as well as third-party services, such as Google Cloud and AWS.

POWERSHELL REQUIREMENTS

As with any product or service that you may want to use, there are a few requirements to know. Before you can deploy PowerShell scripts in Intune, be sure to follow the necessary requirements. Below is a list of these requirements:

  • The devices that you’ll be working on must have Windows 10 1709 or later.
  • Additionally, they should also be Azure AD Joined devices or Hybrid Azure AD Joined devices.
  • These devices will need to be enrolled in Intune. And this can be via MDM Auto Enrollment, GPO enrollment, or Manual enrollment.
  • Lastly, we’ll mention co-managed devices that use both Microsoft Intune and Configuration Manager.

Identification of Printer Driver source files

To begin the process of adding a printer to Windows and printing setup, we’ll need to identify all the required printer driver source files. The driver package is extremely important because it contains everything necessary for a device to work correctly with Windows.

A driver package will typically have an INF file, Catalog files, Driver files, and other files. Before you can build a Win32 app, you need to ensure that you know which specific files you’ll need to complete the Printer Driver installation. After deciding which printer you’ll be using, you can proceed as follows:

  • Navigate to the printer manufacturer’s website, where you can download the appropriate Printer Driver software.
  • To guide you through a UI for the installation of the driver package, you will use the Setup.exe installer. Because this installer doesn’t run silently, you should go to the Driver folder to prepare for driver installation using a PowerShell script.
  • Next, open the INF file to see the files needed for driver installation.
  • Windows then proceeds to leverage a catalog file to check that the files can be trusted. This will be in addition to noting any of the required source files using the INF file.

Windows Driver Store

Most people would probably find it far more convenient if their computers had the necessary driver files for printer installation. This would make the printing setup significantly easier. Fortunately, however, the process of adding drivers to the Driver Store is not an overly difficult one. When we say Driver Store, we are simply referring to the trusted location of inbox and third-party driver packages. The only drivers that you can install on a device are those found in this secure location.

A common way that admins will use for staging drivers into the Windows Driver Store involves the use of pnputil. Some would probably raise their eyebrows at this because pnputil is not actually a PowerShell command. But it does get the job done. And admins can run it from a Powershell console. You can pass various commands to the pnputil.exe command line tool. This command is going to require the directory path of the INF driver file for your particular printer:

Pnputil /add-driver <“inf_path”>

Admins should make sure they note the Printer Driver Name because it’s a requirement for the installation of the Printer Driver in Windows. This is something that you can also find in the INF file. After you have completed the staging of the drivers to the Driver Store, you can now Install a printer in Windows using PowerShell cmdlets such as Add-PrinterPort, Add-PrinterDriver, and Add-Printer.

ADD-PRINTER PORT

Those who will be deploying new Network Printers will need to use the Add-PrinterPort cmdlet to create the Printer Port. Upon completion, you can then run the Add-Printer cmdlet. And this will require passing the DriverName and PortName parameters. So, before you begin trying to install the printer, make sure that the Printer Port is available.

ADD-PRINTER DRIVER

Verify that the Printer Driver has been installed before printer installation with the Add-Printer cmdlet can proceed. You can find the name of the Print Driver in the Driver Store within the INF file. So, you can now go ahead and open this INF file, find the appropriate driver name, and then save it. When using the Add-PrinterDriver cmdlet, IT admins should check that they are using the same Driver Name. To install the Printer Driver directly in Windows from the Driver Store, you can use the Add-PrinterDriver cmdlet.

Add-PrinterDriver -DriverName <“driver_name”> -InfPath <“driver_path”>

ADD-PRINTER

After performing all the above steps, you’ll now get to the last one, which is the actual installation of the printer. Here, we’ll basically be putting together everything that’s already come before so we can have that great result we’ve been wanting. Admins will be able to install the printer using the Add-Printer cmdlet. But, this can only happen after the installation of the printer driver and creation of the printer port. After all this is done, you can check the printer installation using printmanagement.msc.

Add-Printer  -DriverName <“driver_name”> -PrinterName <“printer_name”> -PortName <“port_name”>

How to build your Win32 App

WHAT IS A WIN32 APP?

When we talk of Win32 applications, we’ll be referring to programs that have been built for the Windows operating system. They have been written to use the Win32 Application Programmer Interface (API). The latter is a set of program functions that can enable a program to trigger just about every action in the operating system such as opening a file.

This 32-bit Windows API has been around for a few decades and was first availed back in 1993 when Windows NT was released. The early APIs would become known as Win16 and Win32 to distinguish between 16-bit and 32-bit programs. The Win32 APIs carry the following responsibilities:

  • Administration and management – both play a key role in the installation, configuration, and servicing of apps as well as systems.
  • Diagnostics – involved in the remediation of problems through the troubleshooting of both system and application problems. Also responsible for monitoring performance.
  • Graphics and multimedia – incorporation of various components such as video, audio, graphics, and text.
  • Security – ensures high-level security by implementing measures such as password protection, privileged access, rights management, security auditing, and more.
  • System Services – allows for access to computing resources and the operating system. This will include things such as devices, memory, processes, file system, and threads.
  • Windows User Interface – enables not only the creation but the management of a user interface as well. This is for things like display output, user interaction support, and prompts for input from users.

Win32 App Management Capabilities

Win32 app management capabilities will be fully allowed in Microsoft Intune. In addition, Intune also offers support for 32-bit and 64-bit operating system architecture for Windows applications. There are several different types of files that you can manage using the Win32 App, and these include the very well-known .exe, .msi, and .msix, among others. IT admins will need to know, however, that before they can create a Win32 App in Intune, they will need to package it.

Microsoft Intune has become increasingly important in recent years because more and more businesses are migrating to the cloud. As this trend continues, businesses are looking for a solution like Intune that can help with the management of Win32 apps from the cloud. So, with an Intune subscription, administrators will be able to manage and distribute Win32 apps to your Windows 10 or Windows 11 devices.

WIN32 APP REQUIREMENTS

To deploy Win32 apps with Microsoft Intune, there are several requirements that need to be met. These include:

  • Before you can start deploying Win32 apps, you need to have an active Microsoft Intune subscription. This can be purchased from the Microsoft 365 admin center if you don’t already have one.
  • Your devices must meet all the Microsoft Intune prerequisites, including having Windows devices enrolled in Intune as well as having the Intune Company Portal app installed.
  • The devices you’ll be working on should be enrolled in Intune. They also need to be either Azure AD joined, Azure AD registered, or Hybrid Azure AD joined.
  • The Windows application size must also be no more than 8GB per app.
  • The Win32 apps will need to be prepared for deployment. This can be done by leveraging the Intune Win32 app packaging tool to create an installation package for your app. The conversion of your app into an Intune-compatible format will be facilitated by this package tool, and the reason for this action is to simplify both deployment and management.

BUILDING THE APP

Now that we have gone over what the Win32 App actually is and the steps you need for printing setup, we can start looking at how we are going to build a Win32 App. To build this Win32 App, we will need a few source files: cnlb0m.cat, CNLB0MA64.INF, and gpb0.cab. IT admins are also going to need a few other things to create the Win32 App:

  • Driver package source files.
  • Specify an Install command.
  • Specify an uninstall command.

INSTALL COMMAND

Administrators will need to have several conditions that they need to pass to the script:

  • PortName – Provide the name of the port that you need to create.
  • PrinterIP – Provide the network IP address of the relevant printer.
  • PrinterName – Provide the name of the printer that is going to be created. Admins should be aware that this name is used in the Detection Method as well.
  • DriverName – Provide the name of the printer driver that will need to be installed. Earlier, we mentioned noting down this name so that when it comes to this point, our parameters are as they should be.
  • INF file – Provide the name of the INF file for the printer driver.

UNINSTALL COMMAND

With this option, you’ll get the convenience of uninstalling a Win32 application via the Company Portal. This means that your IT can run a lot more efficiently and get things done quickly rather than waiting around for help desk support to address their issues. It’s no surprise then that this was a highly requested feature by users of Microsoft Intune.

If you no longer want a program or perhaps you need the space, uninstallation is going to be a simple and straightforward affair. Because with this particular command, you will only need to pass a single condition to the script. So, as long as you have a valid command line with the correct input, you shouldn’t have any difficulties. A good example of this would be:

powershell.exe -executionpolicy bypass -file Remove-Printer .ps1 -PrinterName “Generic Printer Office1”

DETECTION METHOD

Another element that the Win32 App is going to require is a detection method. Using a detection method is meant to help administrators verify that an application has not already been installed. By detecting the presence of a Win32 App, this will create a scenario where the installation can only proceed if the check proves that the app has not yet been installed.

IT admins can use the printer’s own registry key for this detection. The PrinterName that we mentioned above (the one that will be used during the installation of the printer) will also be the name of the key.

CREATING THE .INTUNEWIN FILE

  • To begin, both the scripts and the source files must be copied to the same folder.
  • Then, you can proceed to create the .intunewin file using Win32ContentPrepTool.
  • Next, navigate to the Microsoft Endpoint Manager admin center.
  • Create a new Win32 App.
  • You’ll now be required to select an .intunewin file so you choose the one you’ve just created.
  • Provide all the app information necessary without leaving out any details.
  • Now, you can add both the Install and Uninstall commands.

Install command: powershell.exe -executionpolicy bypass -file Install-Printer .ps1 -PortName “IP_10.10.1.1” -PrinterIP “10.1.1.1” -PrinterName “Generic Printer Office1”  -DriverName “Generic Driver ABC” -INFFile “CNLB0MA64.INF”

UNINSTALL command: powershell.exe -executionpolicy bypass -file Remove-Printer .ps1 -PrinterName “Generic Printer Office1”

  • Provide all the necessary information in the app requirements section.
  • Under Detection, select Manually configure detection rules and then select Add.
  • Next, for the detection method, you can use the values listed below. Just ensure the Key/Name accordingly.
  • Rule Type Registry
  • Key path

            HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion\ Print \ Printers \ Generic Printer Office1

  • Value Name Name
  • Detection method String comparison
  • Operator Equals
  • Value Generic Printer Office1
  • The last thing you’ll need to do is make sure that the app is assigned to the correct Users/Devices Group.

INSTALLATION MONITORING

Admins who have created an “Available” assignment for a user group can perform the installation of the Win32 App from the Company Portal. To view the generated log file, you can look in the systemroot %temp% folder. After all this is done, you can check the Printer, Driver, and Port installation using printmanagement.msc.

Wrap up

Having a modern printing setup and solution is something that can be extremely beneficial for your business. It can help your employees work more efficiently, increase productivity levels, safeguard sensitive documents from prying eyes, and many other benefits. A great way to install your Printer Drivers and Printers from Microsoft Intune is by using Win32.

This method, as described in this article, is not as complicated as you may imagine and can simplify the process of modernizing your printing setup and solutions. As long as you meet a few of the requirements that are listed, then your IT admins won’t face too many difficulties. So, if you’re looking for ways to upgrade the way your business operates, then you could hardly go trying by trying this method for your organization.

Feel free to comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.