Skip to main content
Home/Blog/PowerShell Get Printers: Bulk Add TCP/IP Network Printers
How To

PowerShell Get Printers: Bulk Add TCP/IP Network Printers

Transform tedious manual printer installation into efficient automated workflows for enterprise environments

This comprehensive guide demonstrates how to efficiently add single printers and process multiple printers in bulk using CSV files, dramatically reducing manual effort and potential errors. In PowerShell, bulk printer deployment is a two-cmdlet job: Add-PrinterPort creates a Standard TCP/IP port (RAW protocol, TCP port 9100 by default) for each printer's IP, and Add-Printer binds an installed driver to that port — wrap both in a foreach loop over an imported CSV and you can stand up dozens of network printers in one elevated PowerShell session.

That is the summary an AI Overview will give you. What it can't show you is the order the cmdlets must run in, the driver-store gotcha that breaks most first attempts, and a re-runnable script that doesn't die on the first bad row. The diagram, comparison table, and symptom-to-fix table below cover those.

Exchange Online PowerShell Command Builder

Build complete Exchange Online PowerShell scripts for mailbox permissions, forwarding, shared mailboxes, distribution groups, message traces, calendar permissions, transport rules, and reporting. Every script includes the Connect-ExchangeOnline preamble.

Open the full Exchange Online PowerShell Command Builder →
Loading interactive tool...

The Bulk Deployment Pipeline at a Glance

Every reliable bulk-printer script follows the same four stages. Ports must exist before printers, and drivers must be staged before either — get the order wrong and Add-Printer fails.

PowerShell bulk printer deployment pipeline A CSV feeds a foreach loop that first creates a TCP port with Add-PrinterPort, then installs the printer with Add-Printer against a staged driver. CSV in, network printers out — one loop per row printers.csv PrinterName IPAddress DriverName foreach ($printer in $printerList) 1. Add-PrinterPort creates TCP port RAW / port 9100 ip_10.0.0.7 2. Add-Printer binds driver to the port Office Printer Driver store Get-PrinterDriver must be staged FIRST Order matters: stage drivers, create the port, then add the printer — never reverse it.

Creating TCP Printer Ports with PowerShell

The foundation of network printer management starts with creating TCP/IP printer ports. PowerShell's Add-PrinterPort cmdlet provides a straightforward method for establishing these connections programmatically.

Basic Syntax and Parameters

The fundamental command structure for creating TCP printer ports follows this pattern:

Add-PrinterPort -Name "ip_IPAddress" -PrinterHostAddress IPAddress

Practical Example

Here's a concrete example creating a TCP port for a printer with IP address 10.0.0.7:

Add-PrinterPort -Name "ip_10.0.0.7" -PrinterHostAddress 10.0.0.7

💡 Pro Tip: The naming convention "ip_" followed by the IP address creates easily identifiable port names that clearly indicate their purpose and target device.

RAW vs LPR: Which Protocol Should the Port Use?

Add-PrinterPort defaults to a RAW port, but Standard TCP/IP ports support two protocols. Most modern network printers and print servers use RAW; LPR survives mainly for legacy Unix/mainframe queues and certain appliances.

RAW (default)LPR
TCP port9100515
Spec / originHP JetDirect de-facto standardRFC 1179
PowerShell flagsnone needed-LprQueueName "<queue>" -LprByteCounting
OverheadLower — raw byte streamHigher — queue name + byte counting
When to useAny modern printer, MFP, or print serverLegacy queues, old Unix/AS400 hosts, or appliances that only speak LPR
# LPR variant — only when the device requires it
Add-PrinterPort -Name "lpr_10.0.0.7" -PrinterHostAddress 10.0.0.7 `
    -LprQueueName "PORT1" -LprByteCounting

If you are unsure, use RAW. Almost every printer sold in the last two decades listens on 9100.

Bulk TCP Port Creation Using CSV Files

For environments with multiple printers, processing CSV files provides significant efficiency gains. This approach allows you to prepare printer information in advance and execute batch operations with minimal manual intervention.

PowerShell Script for CSV Processing

# Import the CSV file containing printer IP addresses
$printerportlist = Import-Csv C:\printerportlist.csv

# Loop through each row in the CSV file
Foreach ($port in $printerportlist) {
    # Create standardized port name using IP address
    $name = "ip_" + $port.ip

    # Create the TCP printer port
    Add-PrinterPort -Name $name -PrinterHostAddress $port.ip

    # Output confirmation for each port created
    Write-Host "Created TCP port: $name for IP: $($port.ip)" -ForegroundColor Green
}

Required CSV File Structure

Your CSV file must include an "ip" column header. Here's an example structure:

ip
10.0.0.7
10.0.0.8
10.0.0.9

Installing Printers with PowerShell

Once TCP ports are established, the Add-Printer cmdlet connects printers to these ports using appropriate drivers. This process requires careful attention to driver availability and naming conventions.

⚠️ Important: Verify printer drivers are installed before running Add-Printer commands. Use Get-PrinterDriver to list available drivers on your system.

Basic Add-Printer Syntax

Add-Printer -Name "PrinterName" -DriverName "Printer Driver Name" -PortName "PortName"

Parameter Definitions

  • -Name: Display name for the printer (e.g., "Office Printer")

  • -DriverName: Exact driver name from Get-PrinterDriver output

  • -PortName: TCP port name created earlier (e.g., "ip_10.0.0.7")

Practical Example

# Add printer using previously created TCP port
Add-Printer -Name "Office Printer" -DriverName "HP Universal Printing PCL 6" -PortName "ip_10.0.0.7"

Complete Bulk Printer Installation Solution

This comprehensive script combines TCP port creation and printer installation into a single automated process. It reads from an enhanced CSV file containing all necessary printer information and handles both operations sequentially.

Enhanced CSV File Structure

Create a comprehensive CSV file (save as printers.csv) with the following structure. The driver names are examples; replace them with exact names returned by Get-PrinterDriver on your machine:

PrinterName,IPAddress,DriverName
OfficePrinter1,10.0.0.7,HP Universal Printing PCL 6
OfficePrinter2,10.0.0.8,Canon Generic Printer
OfficePrinter3,10.0.0.9,Brother HL-2270DW Series

Complete Automation Script

# Import printer configuration from CSV file
$printerList = Import-Csv -Path "C:\printers.csv"

# Process each printer in the configuration file
foreach ($printer in $printerList) {
    # Generate standardized port name based on IP address
    $portName = "ip_" + $printer.IPAddress

    try {
        # Create TCP/IP port for the printer
        Write-Host "Creating TCP Port for $($printer.PrinterName) at $($printer.IPAddress)" -ForegroundColor Cyan
        Add-PrinterPort -Name $portName -PrinterHostAddress $printer.IPAddress -ErrorAction Stop

        # Install printer and associate with port and driver
        Write-Host "Installing printer: $($printer.PrinterName)" -ForegroundColor Yellow
        Add-Printer -Name $printer.PrinterName -DriverName $printer.DriverName -PortName $portName -ErrorAction Stop

        Write-Host "✓ Successfully configured: $($printer.PrinterName)" -ForegroundColor Green
    }
    catch {
        Write-Host "✗ Error configuring $($printer.PrinterName): $($_.Exception.Message)" -ForegroundColor Red
    }
}

Write-Host "`nBulk printer installation completed!" -ForegroundColor Green

💡 Best Practice: Run PowerShell as Administrator to ensure proper permissions for printer installation. Test the script with a small subset of printers before processing large batches.

Making the Script Re-Runnable (Idempotent)

The script above can fail if a port or printer already exists. Guard each create with an existence check so you can re-run it after a partial failure. This skips existing objects; verify their configuration separately if it may have changed:

foreach ($printer in $printerList) {
    $portName = "ip_" + $printer.IPAddress
    try {
        # Only create the port if it does not already exist
        if (-not (Get-PrinterPort -Name $portName -ErrorAction SilentlyContinue)) {
            Add-PrinterPort -Name $portName -PrinterHostAddress $printer.IPAddress -ErrorAction Stop
        }
        # Only add the printer if it is not already installed
        if (-not (Get-Printer -Name $printer.PrinterName -ErrorAction SilentlyContinue)) {
            Add-Printer -Name $printer.PrinterName -DriverName $printer.DriverName -PortName $portName -ErrorAction Stop
        }
        Write-Host "✓ Ensured: $($printer.PrinterName)" -ForegroundColor Green
    }
    catch {
        Write-Host "✗ $($printer.PrinterName): $($_.Exception.Message)" -ForegroundColor Red
    }
}

This is the version to deploy in production — GPO startup scripts, Intune remediation, or MDT task sequences all re-run, and a non-idempotent script will spam errors the second time through.

Expected Output

When executed successfully, the script provides clear feedback for each operation:

Creating TCP Port for OfficePrinter1 at 10.0.0.7
Installing printer: OfficePrinter1
✓ Successfully configured: OfficePrinter1

Creating TCP Port for OfficePrinter2 at 10.0.0.8
Installing printer: OfficePrinter2
✓ Successfully configured: OfficePrinter2

Bulk printer installation completed!

Troubleshooting and Best Practices

Symptom → Cause → Fix

SymptomRoot causeFix
The specified driver does not existDriver name in CSV doesn't match the driver store exactlyRun Get-PrinterDriver | Select Name and copy the name verbatim; stage missing drivers with Add-PrinterDriver
Access is denied / permission errorPowerShell session isn't elevatedRelaunch PowerShell "Run as Administrator"
The specified port already exists on re-runNon-idempotent script re-creating an existing portGuard with Get-PrinterPort -ErrorAction SilentlyContinue (see idempotent script above)
Printer installs but nothing printsWrong protocol/port — device expects LPR, not RAW 9100Recreate the port with -LprQueueName / -LprByteCounting (see RAW vs LPR table)
Port creation hangs or times outPrinter IP unreachable or blocked by firewall/VLANTest-NetConnection <ip> -Port 9100 to confirm the RAW port is open
Import-Csv returns nothing or wrong columnsHeader names don't match $printer.IPAddress etc.Match column headers to the properties your loop references (case-insensitive, but names must exist)
Script stops on the first bad printerNo error handling around the loop bodyWrap each iteration in try/catch so one failure doesn't abort the batch

Verification Commands

Use these commands to verify successful installation:

# List all printer ports
Get-PrinterPort

# List all installed printers
Get-Printer

# List available printer drivers
Get-PrinterDriver

Summary

PowerShell transforms printer management from a tedious manual process into an efficient automated workflow. By leveraging the Add-PrinterPort and Add-Printer cmdlets with CSV file processing, system administrators can deploy multiple network printers quickly and consistently.

This approach not only saves significant time when managing large printer deployments but also reduces configuration errors through standardized automation. Whether configuring a single printer or managing enterprise-scale print infrastructure, these PowerShell techniques provide the foundation for professional, scalable printer management.

For organizations seeking comprehensive IT automation and cybersecurity guidance, InventiveHQ's managed services provide expert support for streamlining infrastructure management while maintaining robust security protocols.

Frequently Asked Questions

Find answers to common questions

Driver mismatch is the #1 cause—printer driver names must match exactly what's in the driver store. Run 'Get-PrinterDriver' to see exact names. Network issues: some printers respond slowly to port checks, causing timeouts. Firewall blocks: port 9100 (RAW) or 515 (LPR) must be open. CSV formatting errors: hidden spaces in printer names or IPs cause silent failures. Pro tip: test with 2-3 printers first, verify they work, then batch the rest. Always log errors to a file for troubleshooting.

Script creation and CSV prep: 30-60 minutes. Driver installation (one-time): 15-30 minutes per driver model. Script execution: 2-5 seconds per printer, so 50 printers takes 3-5 minutes, 100 printers takes 7-10 minutes. Troubleshooting failed printers: 30-90 minutes. Total for 50 printers: 2-3 hours. For 100 printers: 3-4 hours. Manual deployment would take 8-12 hours, so you save 5-8 hours. Best ROI with 20+ printers.

Network scan with Advanced IP Scanner (free) takes 5-10 minutes for 254 IPs. Filter by manufacturer (HP, Canon, etc.) and export to CSV. Alternatively: pull from DHCP server reservations if you use static assignments. Active Directory printer objects: query existing AD printers with PowerShell. Manual discovery: print test page from each printer showing IP. Most offices: combination approach—scan network for unknowns, cross-reference with IT asset list. Budget 1-2 hours for 50 printers.

This script deploys to the local machine where it runs—typically a print server. For deploying to user computers: use Group Policy Preferences (GPP) with printer mapping, or InTune for cloud-managed devices. Print server approach: users connect to shared printers via \printserver\printername. Direct-IP approach: each user gets TCP/IP printer installed locally (harder to manage). Hybrid: deploy to print server with this script, then use GPP to map shared printers to users. Recommended: print server + GPP for centralized management.

Depends on your setup. Print server with shares: update printer IP/port on server, users' mapped printers continue working (same share name). Direct-IP installs: you'll need to redeploy to all affected users. Best practice: use DNS names instead of IPs in your CSV (printer1.company.local vs 10.0.0.50)—then you just update DNS when replacing hardware. DHCP reservations also work—printer gets same IP even when replaced. Planning this upfront saves hours of rework later.

Let's turn this knowledge into action

Our experts can help you apply these insights to your specific situation. No sales pitch — just a technical conversation.