Manage Citrix Cloud via PowerShell

Welcome to another blog on Citrix and PowerShell. Today we will see how to manage Citrix Cloud via PowerShell. Before getting started please refer to the previous blog if you need to know how to setup the Citrix PowerShell.

Simply Click here (Getting Started with Citrix Cloud via PowerShell).

Let see how to do few things from PowerShell on Citrix Cloud like Getting Sessions details

Get-BrokerSession

Above command will get all of the session that is made to the Citrix Cloud including App session and Desktop session. Below is result of a session details, Obviously I have to hide sensitive details.

get-brokersession result

There are lots of information in Get-BrokerSession where you can select the only fields you need which will make more sense and easy by simply using the below example command for selecting username, sessionstate, establishmenttime, appstate

get-brokersession | select  username,sessionstate,establishmenttime,appstate
Result of the above command

The AppState that Says Active are the Application instance, highlighted to make a not of it.

Now you know how to get data for BrokerSession let me show you what else you can do with it. based on the information we have we can see sessionsate is disconnected. Imagine you have 1000 of disconnected session on floating VDI on the weekend you need to Stop brokering from Citrix Cloud. You can easily write a PowerShell command as below to achieve it.

get-brokersession -Filter {Sessionstate -eq 'Disconnected'} | Stop-BrokerSession

This will get it done rather you logging into the Citrix Cloud and searching for machines that are disconnected and select all to Stop it. this one liner will help you save time where you can set it to run weekly simply, that’s the power of PowerShell.

There are 274 Broker based PowerShell Command, Image the power of the PowerShell combined with Citrix. The Commands from Citrix here

You can basically manage and Automate 95% Admin work with the PowerShell. I have barely scratched the surface with this blog on managing Citrix from PowerShell

Do let me know if there is any specific commands in Citrix Cloud you need to write about or build an automation.

Have a Nice day.

Published by iamfazul

Author of the site

Leave a comment