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:
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:
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.