Takes only the printer name as an argument: (New-Object -ComObject WScript.Network).SetDefaultPrinter('HP LaserJet 5Si') WScript.Network is a little simpler to use, because it has a SetDefaultPrinter method that Invoke-CimMethod -InputObject $printer -MethodName SetDefaultPrinter Invoke the SetDefaultPrinter method: $printer = Get-CimInstance -Class Win32_Printer -Filter "Name='HP LaserJet 5Si'" To use WMI to set the default printer, find the printer in the Win32_Printer collection and then To add a new network printer, use WScript.Network: (New-Object -ComObject WScript.Network).AddWindowsPrinterConnection("\\Printserver01\Xerox5") Without any distinguishing labels, it is not easy to interpret. WSH scripts: (New-Object -ComObject WScript.Network).EnumPrinterConnections()īecause this command returns a simple string collection of port names and printer device names You can also list the printers by using the WScript.Network COM object that is typically used in The simplest way to list the printers installed on a computer is to use the WMI Win32_PrinterĬlass: Get-CimInstance -Class Win32_Printer We will use a mix of both tools to demonstrate specific tasks. Sometimes your USB or power cable might be broken, which can lead to these issues so carefully inspect the cables and make sure that your printer is constantly connected to your PC.You can use PowerShell to manage printers by using WMI and the WScript.Network COM object from The issues with the default printer can also occur due to the problems with cables so make sure to check if your cables are working properly or not if your default printer keeps changing on your PC. Solution Four- Check Your Power Cable and USB Cord
To uninstall the printer driver follow these steps
If the above-mentioned solution doesn't work out then you need to uninstall the drivers of the printer and install the latest driver version again. Solution Three- For All Printers Uninstall the Printer Software
Windows 10 automatically manages your default printer and you might want to prevent Windows from managing your default printer if it keeps changing. Solution One- Turning Off the Let Windows Manage Default Printer Option
Make sure to update your driver as this might be caused by your driver.
You can use one of the workarounds listed below if you want to prevent your default printer from changing on Windows 10 Default Printer Keeps Changing on Windows 10