Copy to “addprng.cmd” and start to add printer for all users:
Use following syntax: addprng computer share (computer is the host where we would like to install new printer - MyComputer) (share is the host and printer where the printer is shared - “\\prnsrv\printer” - without “\\”)
@Echo off REM this command file will add a network printer to a computer remotely REM the parameters are: REM 1 - the name of the computer to which the network printer is to be added REM 2 - the UNC name of the printer to be added REM for example, to add the printer called ThePrinter that is shared from the computer PrintServer REM to the computer called TheClient: REM key this command in a Command Prompt window: REM addglobalprinterremotely theclient printserver\theprinter REM add the specified printer to the specified computer @Echo On rundll32 printui.dll,PrintUIEntry /ga /c\\%1 /n\\%2 @Echo off REM stop the print spooler on the specified computer and wait until the sc command finishes @Echo On start /wait sc \\%1 stop spooler @Echo off REM start the print spooler on the specified computer and wait until the sc command finishes @Echo On start /wait sc \\%1 start spooler
list global printers
rundll32 printui,PrintUIEntry /ge
delete global printer
runas /user:administrator "rundll32 printui,PrintUIEntry /gd /c\\DIR05793 /n\\hzzoprx\dirlex01"
add remote
runas /netonly /user:administrator "rundll32.exe printui.dll,PrintUIEntry /ga /c\\DIR05550 /n\\hzzoprx\dirlex01"