This Blog is a supplement to my website. Please also visit: www.DavidCocke.com

Tuesday, July 15, 2014

Set Default Printer for All Users

One of our customers has been complaining that as different people logon to a particular Windows 7 computer, they always have to manually set the default printer.  The default printer is always different for each person that logs in and the choice Windows chooses is inconsistent.

You could use Group Policy to specify the default printer, but this seemed like overkill considering we are only having this issue on one computer.  In searching the forums, I found a reference to this website: http://www.robvanderwoude.com/2kprintcontrol.php

This led me to learn about the PRINTUI.exe command.  At a CMD prompt, if you type printui and {ENTER} you will see a list of available command line options.

In our case, we clicked START, Devices and Printers, right-clicked on the printer that we wanted to set as the default printer, and chose "Printer Properties".  Then copied the name of the printer exactly as it appears at the top of the General tab to the clipboard to use in the next step.

We then created a SetDefaultPrinter.cmd file and placed it in the All Users Startup folder:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

The contents of the SetDefaultPrinter.cmd contains just one line:
printui.exe /y /n "HP LaserJet P3011/P3015 PCL6"

The "y" tells it to set the default printer and "n" is the name of the printer you want.

Now, no matter who logs into that PC, this command will automatically run and correctly set the default printer.



11 comments:

  1. Very nice. Simple but gets the job done. Thank you!!

    ReplyDelete
  2. Thanks so much for sharing! This is perfect.

    ReplyDelete
  3. I had to use this format on a Server 2012R2 to get it to work.
    rundll32.exe printui.dll PrintUIEntry /y /n\\server\printername

    ReplyDelete
    Replies
    1. Very Nice. Yours worked like a charm for me. All of my printers are shared from our server so this is the way they should be mapped in that case. If the Printer is connected directly to the computer, the OP is correct.

      Delete
  4. Thanks for this helpful page David and thanks Rob for the "\\SERVER" hint. Other hints like above said to use the printer name in General, but when using a share on the server the \\SERVER (or whatever the server name is) is needed.

    ReplyDelete
  5. The first method or second (rundll32.exe printui.dll PrintUIEntry /y /n\\server\printername) did not work for me on Windows Server 2012 R2.

    ReplyDelete
  6. Stupid win 10! Reinstalled and hunting all over for this. THANK YOU THANK YOU. BTW I just copied your line, did a winkey-R, pasted, edited, hit return and done

    ReplyDelete
  7. How do I get the script to run for regular users ? It only runs on startup with admin accounts.

    Thanks

    ReplyDelete
  8. Very simple and nice. Works like a rocket.

    ReplyDelete