Nobody likes to manually install printers. This is not fun. People who tell you otherwise are probably, in fact, lying, mistaken and must enjoy busy work.
Want to know something that’s definitely more fun? Hiking. Hiking is awesome. But also, installing printers remotely from the comfort of your workstation is awesome.
Now that we’ve established that, let’s move on to the fun! (Windows 8.1 / Server 2012 R2 Users: those of you who are using either of these operating systems can follow this link for even more amazing cmdlets in PowerShell that make printer management even more of a breeze!)
As for the rest of us, we’ll have to make due with what we’ve got.
A printer to install
Drivers for above printer
Here is the code. A lot of this may be self-explanatory, but I’m going to explain anyway:
PrinterIP – IP Address of the Printer.
PrinterPort – Port of the printer.
PrinterPortName – Name of the printer port. IP_ is standard for TCP/IP port
DriverName – This is the name of the printer as it appears in the *.inf file (case sensitive).
DriverPath – This is the directory where the printer’s install *.inf file is found.
DriverInf – Full path and file name of the *.inf file.
PrinterCaption – Name of printer as it will appear on the workstation.
ComputerList – Names of the computers you wish to install the printer on. Choose Option 1 or Option 2(If you decide to use Option 2 to import from a .csv file to populate the computers, please change the highlighted word to the appropriate name of the header in your .csv file. My .csv file (ComputersThatNeedPrinters.csv) has a column header named “Computer”) (See Import-Csv)
I’ve broken this script up into 3 functions: Creating the network printer port; installing the printer driver; creating the printer. I make use of WMI for each function (WMI Info). Feel free to use any or all of the functions in your designs.
I cannot guarantee that it will work in every environment, but it’s a pretty “cut and paste” script. If you decide to use it, please test it before rolling it out on any production workstations.
Busy work is monotonous, boring, and (most importantly) not fun. On the other hand, installing printers remotely is pretty fantastic, if you have the right tools.
Go forth and print!
A pastebin of the previous code can be found here.
Did you know that PDQ Deploy has a PowerShell step you can use to deploy your scripts?
Kris was an employee at PDQ.