How to change the print server in Citrix Studio Session Printers policies

I came up with this for a customer, and everyone else now, that needed to replace their session printer policies server.  Previously we had imported their session printer policies from XenApp 6.5 to XenApp 7.6, however they now have a new print server for the 7.6 environment.  The last time I did this I wish I had a way to do this instead of editing each policy manually (for a different client)

The PowerShell leverages the Citrix Group Policy Commands module and is for policies in Studio.  I’ll have to make a couple of edits and test for policies in MS GPO.

This post was very helpful in getting things started http://www.sinisasokolic.com/how-to-set-citrix-xenapp-7-6-policies-with-powershell/ – THANK YOU!!!

<#

@@@ Run on Desktop Delivery Controller @@@

@@@ Purpose: To replace print server on Citrix session printer policies created and maintained in Citrix Studio 7.x @@@

#>

#Maps a connection to the Local Farm GPO Provider on DDC
new-psdrive -name LocalFarmGpo -psprovider CitrixGroupPolicy -controller localhost \

#Import Citrix GPO commands module
import-module “C:\Program Files (x86)\Citrix\Scout\Current\Utilities\Citrix.GroupPolicy.Commands.psm1”

#Create an object for Citrix Group Policy Configuration
$objPol = Get-CtxGroupPolicyConfiguration

#*****CHANGE these values as appropriate*****
$printserver = ‘lasprint1’
$newprintserver = ‘lasprint2’
#********************************************

#Loop through policies
foreach ($policy in $objPol){
#create a holder for all policies with session printer values
$printpol = $policy | where {$_.sessionprinters.values -ne $NULL} | select PolicyName, sessionprinters

#loop through each policy with printers and hold onto policy name and printer values
foreach ($value in $printpol){
$policyname = $printpol.PolicyName
$printers = $value.SessionPrinters.values
$printers = $printers.replace(“$printserver”,”$newprintserver”) #replace server name in printer value string

#Set the new values in the printer policy with the new servername
Set-CtxGroupPolicyConfiguration -PolicyName $policyname -Value “$printers” -Type User -ConfigurationName SessionPrinters

$policyname
write-host ‘Set to…’
$printers

}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s