Jump to content
Welcome to our new Citrix community!
  • 0

Using Powershell to create policies based on AD Group Membership


Roger Pray

Question

Currently we are manually building policies in Citrix 7.15 environment, these policies are for session printers for our new ThinOS WYSE Clients.  I am attempting to slightly automate this process as we have hundreds of printers and thousands of WYSE clients.

 

In the past when we had used Windows Embedded we were able to use AD Groups to assign memberships to the specific device, we built the GPO's and AD Groups using powershell.  I'd like to continue using those same AD Groups with our new WYSE clients.

 

I can create the Citrix Policy, but I'm having issues applying the filter - I am receiving an error that reads:

Attempted to access a path that is not on the disk.

 

My assumption is that this has something to do with the ActiveDirectory module, however the Delivery Controller that we are using doesn't have RSAT loaded and my server team is reluctant to do so.  I had attempted to use a PSSession, but when I did that I lost access to the Citrix Group policy powershell commands.

 

The code as it currently exists is below:

$Policy = Read-Host "Enter the name of the printer for the policy"
$PolicyType = "USER"
$PrtServer = "SERVERNAME"
$FName = $Policy + "Group"
$FType = "DesktopGroup"
$FValue = "<domainname>\"+$Policy+"-PTR"
import-module "<pathtofiles>\Citrix.GroupPolicy.Commands.psm1"

new-psdrive -name LocalFarmGpo -psprovider CitrixGroupPolicy -controller localhost \

New-CtxGroupPolicy -policyname $Policy -Type $PolicyType
Set-CtxGroupPolicyConfiguration -PolicyName $Policy -Type $PolicyType -ConfigurationName SessionPrinters -State "Enabled" -Value "\\$PrtServer\$Policy"
Add-CtxGroupPolicyFilter -policyname $Policy -Type $PolicyType -filtername $Fname -filtertype $FType -filtervalue $FValue

I've tried changing the PolicyType and the FilterType but so far no luck.

Any suggestions?

Link to comment

1 answer to this question

Recommended Posts

  • 0

I have seen similar type of issue in past, I have addressed by updating PowerShell module as below. Can you check it?

 

Citrix.GroupPolicy.Commands.psm1'.

 

Line 844 (in Add-CtxGroupPolicyFilter) from

$item = New-Item "$($DriveName):\$Type\$PolicyName\Filters\$FilterType\$FilterName" $FilterValue -ErrorAction Stop

to

$item = New-Item -Path "$($DriveName):\$Type\$PolicyName\Filters\$FilterType\$FilterName" -Value $FilterValue -ErrorAction Stop

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...