Get the App
SLTechnology News&Howtos  ›  Servers  › 

PowerShell configures the printer through the COM object

Shulou Source: shulou.com Published: 2022-06-03 04:24:29 09月22日 Update

(1) list printers

Get-WmiObject-Class Win32_Printer-ComputerName (New-Object-ComObject WScript.Network) EnumPrinterConnections ()

(2) add printers

(New-Object-ComObject WScript.Network) .AddWindowsPrinterConnection ("\\ Printserver01\ Xerox5")

Set the default printer

(Get-WmiObject-ComputerName. -Class Win32_Printer-Filter "Name='HP LaserJet 5Si'") .SetDefaultPrinter () (New-Object-ComObject WScript.Network) .SetDefaultPrinter ('HP LaserJet 5Si')

(3) Delete printers

(New-Object-ComObject WScript.Network) .RemovePrinterConnection ("\\ Printserver01\ Xerox5")

You can also follow the official Wechat account below for more information.

Tags: Printer Public more Information object configuration Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info macOS vpn Redmi NVidia