Automate Network Printers installation through PowerShell

Welcome to this technical guide entitled “Automate Network Printers installation through PowerShell”. This guide is intended for anyone looking to simplify and automate the installation of network printers in a corporate environment. PowerShell, a powerful scripting language developed by Microsoft, offers an efficient solution for automating these repetitive and time-consuming tasks. In this guide, we’ll explore how to use PowerShell to automate the installation of network printers, which can greatly improve the efficiency and productivity of your IT team.

1 – Prerequisites :

  • An online storage account on Azure, AWS, google or another storage account on the internet to store then download the printer driver.
  • PCL6 Printer driver file.
  • Administrator or system rights to run the script.

2 – How to use the following script :

we can use the following script with :

  • An active directory GPO.
  • An RMM solution (NinjaOne, Datto RMM, Atera RMM, N-Able RMM, Zenworks RMM…etc).
  • Run on a local machine directly from the powershell console in stand-alone mode.

3 – Mindmap to Automate Network Printers installation through PowerShell :

4 – Store PCL6 Driver on cloud and generate https link :

If you have azure storage account ou can follow steps in this technical guide to upload PCL6 driver and generate https link on (II – Prepare Wallpapers section) :

Otherwise, you can store the driver in any other account storage and generate https link (you can use AWS, Google, dropbox, Onedrive…etc)

5 – Before Executing the script :

Before Executing the script, we must provide some details like :

* https URL to download driver (from previous section)
* Printer IP Address
* Printer Name + Model
* driver inf file name :

Follow this setps to get this detail :

Download and extract the PCL6 zip file and copy inf file name to notepad to use it later in the following script (in my case KOAXGJ_.inf as you can see in the following screenshot).

* Printer driver name :

Open the previous inf file with notepad (KOAXGJ_.inf) then copy the driver name from amd64 section : “KONICA MINOLTA C360iSeriesPCL” (C360i is compatible with C250i , I got this information from the provider)

We will use all this details in the following script.

6 – Script for Network printer installation :

Before executing the script, you should replace details in the first section (Variable to add here)

 # ------------------------------------------------------------- Variable to add here ----------------------------------------------------------------------------

# https link to download printer driver
$Url = 'https_Link'

# Printer name that will displayed after printer installation
$Printer_Name = "Konica Printer (First floor)"

# Printer model
$PrinterModel = 'Konica_C250i'

# Inf file that contain all drivers
$inf_File = 'KOAXGJ__.inf'

# Printer IP address
$Printer1_IP = "172.16.10.200"

# Printer driver name : we can get this information directly from printer inf file
$Driver_Name = "KONICA MINOLTA C360iSeriesPCL"

# ------------------------------------------------------------- Download and extract file ----------------------------------------------------------------------------

# Create a temporary directory to store Driver
$TempDir = "C:\temp\" 
if((Test-Path $TempDir) -eq $false)
{
    New-Item -ItemType Directory -Path $TempDir -erroraction SilentlyContinue | Out-Null
}

$Download = $TempDir + $PrinterModel


# Download the Konica_C250i file
Invoke-WebRequest $Url -OutFile $Download

# Unzip downloaded file
Expand-Archive $Download -DestinationPath $TempDir 


# ------------------------------------------------------------- Install printer ----------------------------------------------------------------------------

# Define portName from IP address
$Port1_Name = "IP1_" + $Printer1_IP

# Windows driver Repository
$Windows_Repository = "C:\Windows\System32\DriverStore\FileRepository\"

# Add driver to the driver store
& Pnputil /add-driver ($Download + '\' + $inf_File) /install

# Install the driver from windows driver store : C:\Windows\System32\DriverStore\FileRepository
$Driver_Folder = (Get-Item -Path ($Windows_Repository+'*') | Select Name | where Name -like 'KOAXGJ__.inf*').Name
Add-PrinterDriver -Name "KONICA MINOLTA C360iSeriesPCL" -InfPath ($Windows_Repository + $Driver_Folder + '\' + $inf_File )

# Creating printers ports 
Add-PrinterPort -Name $Port1_Name -PrinterHostAddress $Printer1_IP

# Installing the first printer
Add-Printer -Name $Printer_Name -DriverName $Driver_Name -PortName $Port1_Name 

here is the result of execution script :

Conclusion :

In conclusion, automating network printer installation using PowerShell can transform the way your IT team manages printers in your organization. Not only does it save time and effort, it also reduces the potential for human error. We hope this guide has provided you with the knowledge and skills you need to start automating your network printer setup. Remember, practice makes perfect with PowerShell. So start scripting and automating today!

Thanks

Aymen EL JAZIRI (Microsoft MVP)
Aymen EL JAZIRI (Microsoft MVP)

Hi, I’m Aymen El Jaziri , a passionate System Administrator and Microsoft MVP, with years of hands-on experience in managing and securing modern IT infrastructures.
This blog is where I share technical guides, automation scripts, product reviews, and real-world solutions that help IT professionals simplify their day-to-day work and stay ahead in a fast-evolving cloud ecosystem.
Whether you’re here to troubleshoot an issue, improve your automation game, or learn new best practices , welcome in my blog !
Let’s build a stronger, smarter IT community together.
Feel free to connect with me on LinkedIn for more content, discussions, or collaboration opportunities.

Thanks

Aymen

Articles: 154