Thursday, August 18, 2016

How to set default printer for local or remote user

Set Default Printer Via Command Line

to get the printer name
wmic printer get name

for local user

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -t -p <printer name>


RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "printer"

rundll32 printui.dll,PrintUIEntry /y /q /n “Printer name”

set a user's default printer for remote user
RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n"\\JSI001.JSIINC.COM\HP Business Inkjet 2250 (PCL5C)"

wmic to set default printer

get the list of printers installed on the computer

wmic printer get name,default
on remote pc:
cscript prnmngr.vbs -l [-s RemoteComputer] [-u UserName -w Password]

get the default printer name
On local pc

wmic printer where default='TRUE' get name
On remote pc
cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -g -s <hostname>

set the default printer

wmic printer where name='printername' call setdefaultprinter
on remote:
cscript prnmngr.vbs -t -p PrinterName -s <hostname>

To delete the printer named ColorPrinter_2 from the remote computer named HRServer, type:
cscript prnmngr.vbs -d -s HRServer -p ColorPrinter_2
To delete all of the printers from a computer
cscript prnmngr.vbs -x [-s RemoteComputer] [-u UserName] [-w Password]
cscript prnmngr.vbs -d -p PrinterName [-u UserName -w Password] [-s RemoteComputer]
To add a printer named ColorPrinter_2 that is connected to LPT1 on the local computer and requires a printer driver called Color Printer Driver1, type:
cscript prnmngr.vbs -a -p ColorPrinter_2 -m "Color Printer Driver1" -r lpt1:
To add a printer connection

Syntax

cscript prnmngr.vbs -ac -p PrinterName 
-ac   Required. Specifies that you want to add a printer connection.
To add a local printer

Syntax

cscript prnmngr.vbs -a -p PrinterName [-s RemoteComputer-m DriverName -r PortName [-u UserName -w Password]
https://technet.microsoft.com/en-in/library/bb490973.aspx


No comments:

Post a Comment