Created
April 14, 2014 04:51
-
-
Save rysstad/10616903 to your computer and use it in GitHub Desktop.
Add printer connection to Windows with Powershell.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$PrinterPath = "\\printerServer\printerShare" | |
$PrinterName = "PrinterName" | |
$wmiNet = new-Object -com WScript.Network | |
$wmiNet.AddWindowsPrinterConnection($PrinterPath) | |
# Set as default | |
(New-Object -ComObject WScript.Network).SetDefaultPrinter($PrinterName) | |
# List all printers | |
# (New-Object -ComObject WScript.Network).EnumPrinterConnections() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment