Installing Printers

by Oct 5, 2018

Starting with Windows 8 and Server 2012 R2, these operating systems ship a PowerShell module called PrintManagement. The cmdlets found in this module can be helpful to script printer installations and configuration. Here is a simple chunk of code to get you started:

$PrinterName = "MyPrint"
$ShareName = "MyShare"
$DriverName = 'HP Designjet Z Series PS Class Driver'
$portname = "${PrinterName}:"

Add-PrinterDriver -Name $DriverName
Add-PrinterPort -Name $portname 
Add-Printer -Name $PrinterName -DriverName $DriverName -PortName $portname -ShareName $ShareName 

# requires Admin privileges
# Set-Printer -Name $PrinterName -Shared $true

It installs a new printer from the driver store. The new printer initially is not yet shared in the network because sharing would require Administrator privileges. As an Admin, you can either run Set-Printer to enable sharing, or add the -Shared switch parameter to Add-Printer.

To explore the other cmdlets found in the module PrintManagement, run this:

PS> Get-Command -Module PrintManagement  

Please note that this module is not available in Windows 7, and there is no way to install it elsehow on Windows 7 because Windows 7 is missing some of the prerequisites required to run the cmdlets in this module.

Twitter This Tip! ReTweet this Tip!