Set a new windows default printer via Powershell.


To find the new printer the Get-WmiObject commandlet with the -Class Win32_Printer parameter can be used. The printer can then be set as the default printer by calling the function SetDefaultPrinter()

$devicename = 'newDefaultPrinterName'

$oldDefaultPrinter = Get-WmiObject -Class Win32_Printer -Filter "Default=True"
$newDefaultPrinter = Get-WmiObject -Class Win32_Printer -Filter "DeviceID='$devicename'"
#Perform actions with the new default printer

  • Define the name of the printer that should be set as the default printer. In this example it is 'newDefaultPrinterName'
  • Save the current default printer
  • Get the printer that should be the new default printer by its name
  • Set the new printer as the default printer
  • Perform actions with the printer
  • The previous default printer can be restored

List all available printers:

To list all available printers and their names the Get-WmiObject commandlet can be used:

Get-WmiObject -Class Win32_Printer