Windows

Set Default Printer Based on Location

Set Default Printer Based on Location

If you are an administrator and you are looking for an easy way to set the default printer based on the location a user logs on, this is possible with a login script and a simple registry file to be imported at the user login session.

In order to set your environment up to work with the registry import, there are a few things that you want to have in place beforehand.

  • Install all printers that you would like to be available to a user as a possibility for setting as the default
  • Have a login script in place that has the batch code in it to set the printer, or alternatively call a “printer.bat” file to run the printer configuration
  • Have a registry file in place that matches the “computername” of the workstation the user is logging into
  • Make sure your user is not restricted from 1) running batch files 2) editing the registry via group policy or other means

 

Let’s take a look at the batch file code that is used to call the registry file:

If exist “%LogonServer%\\Netlogon\\%ComputerName%.REG” regedit /S “%LogonServer%\\Netlogon\\%ComputerName%.REG”

In the above code, the login script will look at the domain controller netlogon directory which is where the login script is called from and look to see if there exists a registry file for the workstation that the user is logged into.

The registry file:

REGEDIT4

[HKEY_CURRENT_USER\\Software\\Microsoft\Windows NT\\CurrentVersion\\Windows]
“Device”=”Someprinter,winspool,Ne00:”
In the registry file above, the “Someprinter” is the name of the printer on the workstation that you want set to the default.ย  It is suggested that you actually name the printer something meaningful such as the location or room number that the printer resides. Also, it is essential that you name the above registry file the name of the workstation exactly.ย  Any misspellings or typos here will result in the printer not getting set correctly because the code looks for the exact computername.ย  So for example:

“Paulsworkstation.reg”

Application:

This is a really powerful tool to utilize in a multi workstation environment such as at a school or university.ย  If you have students logging into 10 different computer labs and don’t want the students to have to choose which printer is the correct printer.

Many administrators set their printers via group policy and that is great.ย  The only issue with group policy is that in many environments there may be sporadic problems with group policy applying settings that you want it to apply and so forth.ย  We have seen the registry/login script method work in a number of environments and different operating systems without any problems and it always works correctly.

 


Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.