Rewrote the scripts as they didnt work is some situations and caused some very strange errors.
Aslo to remove some potential errors with client session printers a network printer shuold now be set in the policies though this will get changed by the scripts.
I just covered how to push down Session Printers in Citrix based on Active Directory membership in my last post. This method does however have one problem and that is that the users Default Printer preference will be discarded upon logout. To get around that the with some scripts can be set up in the users login script to restore the previous default printer. Also the free Defset utility will also need to be added as a published application for the users to use to change their default printer instead of the normal way.
You will need to download and save theDefSet utility onto each citrix server available form http://www.ctrl-alt-del.com.au/CAD_Utils.htm. In my case I just saved it to %windir%.
Once downloaded you will need to add a plublished application for the user to run this tool and set their default printer. It should use the following command line to execute.
%windir%\defset.exe /PA
Also save the following VBScript onto your Citrix servers where you put DefSet. The Adobe PDF printer is a default that will be used if no preference is set of if there is some error in the proccess though it can be changed here.
SetDefault.vbs
On Error Resume Next
Err.Clear
Set WSHNetwork = CreateObject("WScript.Network")
Set ArgObj = WScript.Arguments
if ArgObj(0) = "Document" then
WSHNetwork.SetDefaultPrinter "Adobe PDF"
Else
WSHNetwork.SetDefaultPrinter ArgObj(0)
End if
if Err.Number <> 0 then
WSHNetwork.SetDefaultPrinter "Adobe PDF"
End if
After that you will need to create a Group Policy that will apply to all the Citrix users. In this policy you will need to add the following login scripts.
SetPrinterDefault.bat
rem @echo off
echo Waiting for network printers to appear.
timeout 15
echo Setting user default printer.
FOR /F "eol=; tokens=3 delims=\" %%i in (%userprofile%\Windows\defset.ini) do (
cscript.exe %windir%\SetPrinterDefault.vbs "%%i"
)
This will in essence work now but any client side printers published to the session will not save properly. To fix this add the following Citrix Policy to the Group Policy we already created.Policy: Client printer names
Value: Legacy printer names
We also need to set a default printer in the policy so that client side printers not cause errors durring startup. Specificly what will happen is that if one of them gets assigned as a default durring the normal winodws logon proccess then the utilities will not work properly. To get around this we will set a server side default printer and then the login script will change it. This printer will need to be a session printer shared out to all the citrix users, though the default will just be changed so they won't really be printing to it. We just use our support printer but you could jsut as easily use a fake printer. Add the following Citrix Policy to the Group Policy we already created.
Policy: Default Printer
Value: \\PrintServer\GlobalSharedPrinter
Please note that changing the default printer must be done with the DefSet tool and changing the printer in Windows will still be ignored on logoff.
No comments:
Post a Comment