Use powershell universal API and Citrix Module

Product: PowerShell Universal
Version: 2.4.1 IIS hosting Mode with Service account 2019Core

Hello,

it’s possible to use Citrix Module/Snapin with Powershell Universal API ?

Thanks

Regards,

Mathieu

I personally haven’t used the snap in, but it’s loaded with add-pssnapin, so not sure if there’s a way to install this wherever Powershell universal is installed and run the commands remotely, alternatively you could look to do something with invoke command instead and run your commands though a ps session. In theory there’s no reason why not!

Hello,

I will try this way

thanks

Regards,

For Anyone looking to do this use Secret Variables and the DCC FQDN as a variable pass those to
-ComputerName and -Credential in Invoke-Command

Invoke-Command -ComputerName $DCC_VAR -Credential $SVC_ACC_Creds -Scriptblock {Get-BrokerMachine or another Command}

Note: Account you use must be a Citrix Admin or within the Local Admin Group on the Remote Machine.

1 Like

You can I do this for a dashboard or API (Depending on configuration).

You need to make sure the environment you are running is using native PowerShell not PS Core. However with APIs you can only run all APIs in one version. So it is limited based on needs. We run all our APIs on PS Core 7.X so I cant use the citrix stuff in APIs (Just use it in a dashboard) But if you are running on Native PS then you could.

Install all the needed powershell modules on your PSU server.

Make sure in your environments you load the citrix module and any Secrets you need

Get-BrokerSession -AdminAddress $Citrix_URL | select UserFullName,SessionState,LaunchedViaPublishedName,SessionKey

Then you can just run the commands like above.

We run our PSU as a service with a service account that is granted permissions on the citrix delivery controller so I dont need to supply creds as the service account already has them. But you can pass creds down too.

1 Like