CMD - How to add UNC printer automatically


One of my departments told me that they want to add one more printer which been shared on the LAN.
OS: I need to go their desk and install it each one by one? Yes, I can do that..  But do I have other way to achieve this goal?
Made a “CMD” type to do that
Open your TextNote tool, and save this Code as a “xxx.cmd” file (ex: AddUNCPrinter.cmd)
   1: REM add a known printer to the specified computer

   2: @Echo On

   3: rundll32 printui.dll,PrintUIEntry /ga /c\\%1 /n\\%2

   4: @Echo off


   6: REM This step is to stop the Printer Spooler Service on Client PC

   7: @Echo On

   8: start /wait sc \\%1 stop spooler

   9: @Echo off


  11: REM This Step is to start the printer spooler Service on Client PC

  12: @Echo On

  13: start /wait sc \\%1 start spooler

How to Use the Code?

AddUNCPrinter + clientPCName  + printserverName\theSharedprinterName 
(not including “+” mark)

EX: AddUNCPrinter  HR-Mike Corp\HRHP5000
Technorati Tags: ,,


We had “ADD” function, but if they need to remove the shared Printer??

Then same steps as above

Open your TextNote tool, and save this Code as a “xxx.cmd” file (ex: RemoveUNCPrinter.cmd)

   1: @Echo On

   2: rundll32 printui.dll,PrintUIEntry /gd /c\\%1 /n\\%2

   3: @Echo off


   5: @Echo On

   6: start /wait sc \\%1 stop spooler

   7: @Echo off


   9: @Echo On

  10: start /wait sc \\%1 start spooler
Newer Older