Wednesday, September 22, 2010

Powershell - Setting default printer in the Desktop

In Windows 7 setting a default printer through powershell cmdlets is a easier task when compared to VBscript. It can achieved through fewer commands. The commands and their description are given below


$Printer = Get-WmiObject win32_printer  | where {$ -match "XPS"}

"XPS" in the command can be replaced by your printer name , unique word which will exactly point your printer can be mentioned within the quotations  


This WMI class will hold all the printer information in your computer


This method inside Win32_Printer will set the selected printer as a default printer

No comments: