Skip to content

Instantly share code, notes, and snippets.

@rysstad
Created April 14, 2014 04:51
Show Gist options
  • Save rysstad/10616903 to your computer and use it in GitHub Desktop.
Save rysstad/10616903 to your computer and use it in GitHub Desktop.
Add printer connection to Windows with Powershell.
$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