Link to home
Start Free TrialLog in
Avatar of Mauro Cazabonnet
Mauro CazabonnetFlag for United States of America

asked on

Parse XenDesktop CitrixGroupPolicy from a non DDC server

I need to parse XD 5.6 and 7.6 policy settings
This works fine on a DDC, should I not be able to perform the same on a non DDC

All snapins load successfully on Non DDC
PS-Drive will not mount stating XD Broker snapin is required

Thoughts.....

Param(
	[Parameter(Mandatory=$True)][string]$controller,
	[Parameter(Mandatory=$True)][string]$site
)

Add-PSSnapin Citrix.ADIdentity.Admin.V1, Citrix.Broker.Admin.V1, Citrix.Common.GroupPolicy, Citrix.Configuration.Admin.V1, Citrix.Host.Admin.V1, Citrix.MachineCreation.Admin.V1, Citrix.MachineIdentity.Admin.V1 #-ErrorAction SilentlyContinue

$psDrive = "SiteGPO"
$scriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
$workingPath = (Get-Location).Path
$controllerCollection = @()
$policyCollection = @()
$policyFilterCollection = @()
$policySettingCollection = @()
$policyDomains = @("Computer", "User")
$schemaCollection = @()
Remove-Item -Force -Path ($workingPath + "\" + $site.ToLower() + "_controllers.csv") -ErrorAction SilentlyContinue
Remove-Item -Force -Path ($workingPath + "\" + $site.ToLower() + "_policies.csv") -ErrorAction SilentlyContinue
Remove-Item -Force -Path ($workingPath + "\" + $site.ToLower() + "_policyfilters.csv") -ErrorAction SilentlyContinue
Remove-Item -Force -Path ($workingPath + "\" + $site.ToLower() + "_policysettings.csv") -ErrorAction SilentlyContinue
Remove-Item -Force -Path ($workingPath + "\" + $site.ToLower() + "_schemas.csv") -ErrorAction SilentlyContinue

New-PSDrive -Name $psDrive -PSProvider CitrixGroupPolicy -Root \ -Controller $controller

Open in new window

Avatar of Carl Webster
Carl Webster
Flag of United States of America image

I fixed this in my documentation scripts.

http://carlwebster.com/downloads

Citrix does not automatically create the necessary drives. When you run Scout, it works around these issues.

My documentation scripts for 5.x and 7.x allow you to get all the policy details for both Site and AD Citrix related policies.
Avatar of Mauro Cazabonnet

ASKER

I need to run scout in tandem with the powershell script?
No. Scout is a separate Citrix utility that also has the updated Group Policy module. In the ReadMe file for either script is a link to download the group policy powershell module.
Using that module Citrix.GroupPolicy.Commands from https://dl.dropboxusercontent.com/u/43555945/Citrix.GroupPolicy.Commands.zip
After I import the module I should be able to run this from a non ddc machine?

New-PSDrive localfarmgpo -psprovider citrixgrouppolicy -root \ -controller $AdminAddress -Scope Global

When I run from my non ddc device I'm getting
New-PSDrive : The XD Broker snap-in is required
Nope, look at the ReadMe file. You either have to install Studio to get all the necessary PowerShell stuff installed or install all the PowerShell stuff independently. Citrix could not have made the process more difficult.
OK,
These are the snapin's I have registered
Based on what I have the new-psdrive should work

Name        : Citrix.ADIdentity.Admin.V1
PSVersion   : 2.0
Description : Manages Active Directory Computer Accounts

Name        : Citrix.ADIdentity.Admin.V2
PSVersion   : 2.0
Description : Manages Active Directory Computer Accounts 

Name        : Citrix.Analytics.Admin.V1
PSVersion   : 2.0
Description : This Snapin is for managing the Analytics service 

Name        : Citrix.Broker.Admin.V1
PSVersion   : 2.0
Description : This PowerShell snap-in contains cmdlets used to manage the Citrix Broker.

Name        : Citrix.Broker.Admin.V2
PSVersion   : 2.0
Description : This PowerShell snap-in contains cmdlets used to manage the Citrix Broker.

Name        : Citrix.Common.Commands
PSVersion   : 2.0
Description : Citrix Common Commands

Name        : Citrix.Common.GroupPolicy
PSVersion   : 2.0
Description : Citrix Group Policy Provider

Name        : Citrix.Configuration.Admin.V1
PSVersion   : 2.0
Description : Stores Service configuration information

Name        : Citrix.Configuration.Admin.V2
PSVersion   : 2.0
Description : Stores service configuration information. 

Name        : Citrix.ConfigurationLogging.Admin.V1
PSVersion   : 2.0
Description : This Snapin is for managing configuration logging 

Name        : Citrix.DelegatedAdmin.Admin.V1
PSVersion   : 2.0
Description : This Snapin is for managing Delegated Administration 

Name        : Citrix.EnvTest.Admin.V1
PSVersion   : 2.0
Description : This Snapin is for managing the Environment Test Service 

Name        : Citrix.Host.Admin.V1
PSVersion   : 2.0
Description : Manages Hosts, and Hypervisor Connections

Name        : Citrix.Host.Admin.V2
PSVersion   : 2.0
Description : Manages Hosts, and Hypervisor Connections 

Name        : Citrix.MachineCreation.Admin.V1
PSVersion   : 2.0
Description : Creates new Virtual Machines

Name        : Citrix.MachineCreation.Admin.V2
PSVersion   : 2.0
Description : Creates new Virtual Machines 

Name        : Citrix.MachineIdentity.Admin.V1
PSVersion   : 2.0
Description : Manages Virtual Machine Storage

Name        : Citrix.Monitor.Admin.V1
PSVersion   : 2.0
Description : This Snapin is for managing the FMA Monitor Service 

Name        : Citrix.Sdk.Proxy.V1
PSVersion   : 2.0
Description : This PowerShell snap-in contains CWC Authentication cmdlets.

Name        : Citrix.Storefront.Admin.V1
PSVersion   : 2.0
Description : This Snapin is for interfacing with Storefront 

Name        : Citrix.UserProfileManager.Admin.V1
PSVersion   : 2.0
Description : This Snapin is for managing UPM 

Name        : Microsoft.Exchange.Management.PowerShell.E2010
PSVersion   : 1.0
Description : Admin Tasks for the Exchange Server

Name        : Microsoft.Exchange.Management.Powershell.Support
PSVersion   : 1.0
Description : Support Tasks for the Exchange Server

Name        : PvsPsSnapIn
PSVersion   : 2.0
Description : This is a PowerShell snap-in that includes cmdlets.

Name        : VMware.DeployAutomation
PSVersion   : 2.0
Description : Cmdlets for Rule-Based-Deployment

Name        : VMware.ImageBuilder
PSVersion   : 2.0
Description : This Windows PowerShell snap-in contains VMware ESXi Image Builder cmdlets used to generate custom 
              images.

Name        : VMware.VimAutomation.Core
PSVersion   : 2.0
Description : This Windows PowerShell snap-in contains Windows PowerShell cmdlets for managing vSphere.

Name        : VMware.VimAutomation.License
PSVersion   : 2.0
Description : This Windows Powershell snap-in contains cmdlets for managing License components.

Name        : VMware.VimAutomation.Vds
PSVersion   : 2.0
Description : This Windows PowerShell snap-in contains cmdlets that let you manage vSphere Distributed Switches.

Name        : WDeploySnapin3.0
PSVersion   : 2.0
Description : This is a PowerShell snap-in that contains cmdlets for managing Microsoft Web Deployment infrastructure.

Open in new window

A bit stumped.....
Does my script not give you what you need?
Sample output
Failing on the New-PSDrive

VERBOSE: 05/06/2016 14:25:39: Processing XenDesktop Policies
VERBOSE: 05/06/2016 14:25:39: Does localfarmgpo PSDrive already exist?
VERBOSE: 05/06/2016 14:25:39:  Retrieving Site Policies
VERBOSE: 05/06/2016 14:25:39:   Creating localfarmgpo PSDrive
WARNING: Unable to create the LocalFarmGPO PSDrive on the XenDesktop Controller
wnyce5fgeapd1.hvdlab.corp.bankofamerica.com
VERBOSE: 05/06/2016 14:25:40:
VERBOSE: 05/06/2016 14:25:40: See if there are any Citrix AD based policies to process
VERBOSE: 05/06/2016 14:25:40: Testing for an Active Directory environment
VERBOSE: 05/06/2016 14:25:40: In an Active Directory environment

Open in new window

Then I would run Scout and see if there are any issues in your configuration.

When I do my testing for my scripts, this is what I use and all I ever need to do:

add-pssnapin *citrix*
import-module citrix.grouppolicy.commands

remove-psdrive localfarmgpo
new-psdrive localfarmgpo -psprovider citrixgrouppolicy -root \ -controller wnyce5fgeapd1 -Scope Global
get-ctxgrouppolicyconfiguration -policyname unfiltered -drive localfarmgpo -configured
Ok I think I'm missing something
Citrix Desktop Studio si working I can see the policies for the remote ddc
From powershell it's not working
Carl there shouldn't be an issue mounting the policy from a non-ddc with all the snapins installed
correct?
You are correct. I do it all the time.
I am running this from my WIndows 10 VM:

PS C:\Webster> new-psdrive localfarmgpo -psprovider citrixgrouppolicy -root \ -controller Studio76LTSR -Scope Global

Name           Used (GB)     Free (GB) Provider      Root                                               CurrentLocation
----           ---------     --------- --------      ----                                               ---------------
localfa...                             CitrixGrou... localfarmgpo:\


PS C:\Webster> get-ctxgrouppolicyconfiguration -policyname "Sample Policy" -drive localfarmgpo -configured

PolicyName    Type     MultimediaConferencing
----------    ----     ----------------------
Sample Policy Computer @{State=Prohibited; Path=ICA\Multimedia\MultimediaConferencing}
Sample Policy User
ASKER CERTIFIED SOLUTION
Avatar of Carl Webster
Carl Webster
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thx for the assist......