13.Dec.2009 |
by Gusac |
Filed in: Articles, Troubleshoot
In Windows Terminal Server environment we sometime run into situation where users do not get their default printers. When users redirect their client side printers, they do not get a printer set as default or the default printer set in the session is not the same as on the client. This especially annoying when you have an application installed which prints directly to the default printer. In this scenario, the printing would fail because we do not have any printer set as default.
For a user session, the information for default printer is stored at the following location in registry:
HKEY_ CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
Value: Device
Value Type: REG_SZ
Value Data:<printer description string>
where <printer description string> is the value that Print Manager would put in if this operation were done through Print Manager. It would resemble one of the following:
\\SERVER\PrinterShare,winspool,Ne00: or PrinterName,winspool,LPT1:
The Ne00 is a network port and LPT1 a local port.
The value for the this key is set everytime a user creates a session.
Session default printer registry key
Verify if the above key exists. If it does not, create one. Leave the Device value empty. Windows should set the information when user logs in next time
Check the permission on the key.
- Sytem, Administrators and Creator Owner groups should have Full Permissions on the key and all subkeys.
- Additionally, we can run Process Monitor on the server at the time user login and capture logs to check for any possible permission issue while writing to this specific registry key.
The Group policy
Verify the following group policy is either Not Configured or Disabled.
Computer Configuration > Administrative Templates > Windows Components > Terminal Services > Client/Server data redirection
Do not set default client printer to be default printer in a session.
You can run the Resultant set of policy (RSOP.MSC) to confirm what policies are being hit on the server.
Terminal Server Configuration
Verify that Default to main client printer option is checked in Terminal Server Configuration.
- Go to Start > Run and type 'TSCC.MSC' (Windows 2003) or 'TSCONFIG.MSC' (Windows 2008)
- Right click on the connection name you want your users to connect and redirect, go to properties.
- On the Client Settings tab, under Connection, clear the Use connection settings from user settings check box.
- Check the option: 'Default to main client printer'
Bad Profile
Try recreating a profile. It should fix the issue. If it does not, then most likely the default profile has the issue. Check the default profile:
- Open registry editor and load the default user hive:
In Registry editor, highlight HKEY_USERS and click on File menu > Load Hive option.
Navigate %systemdrive%\Documents and settings\Default (Windows 2003)
%systemdrive%\Users\Default (Windows 2008)
In the Key Name Field, give the name NTUSER
- Navigate to the following key:
HKEY_USERS\NTUSER\Software\Microsoft\Windows NT\CurrentVersion\Windows
- Check the above mentioned key exist and have appropriate permissions. Verify that CREATOR OWNER group has read and write permissions.
- Another option is to replace the default NTUSER.DAT from a working machine. But that would work for the profiles created afterwards. Existing profiles will have not any affect.
Login Script - Last resort
If it comes out to be registry problem like key missing or incorrect value, We would need to change that for all the users. Replacing the default NTUSER.DAT will not help because it comes into the picture when a new profile is created. Default profile is like a template, used to create new profile. So, if a user profile is already created and has the key missing or corrupt, replacing default ntuser.dat is not the option.
One option is to make the changes manually for all the users :) and another is to create a batch file to create the key and use it as logon script.
The batch file needs to create a simple Reg Add command to add Device value to every user's registry. Here is the command:
reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v Device /t REG_SZ /f
Few things to note here:
- We are creating an empty value 'Device' here. Information for default printer should be set automatically when user logs on.
- Notice the Registry type is String value: REG_SZ
- We have used the /f switch to Force overwriting the key without any prompt.