Citrix Powertools | reset-machine-ifDisconnectedUser.ps1

1 min read
Citrix Powertools | reset-machine-ifDisconnectedUser.ps1
Migrating to a new site and new desktop can be tricky in a 24-7 environment

Powertools

A set of Powershell based scripts to simplify managing a Citrix site and unlocking its hidden features.

reset-machine-ifdisconnecteduser.ps1

https://github.com/virtualizebrief/collection/blob/main/cvadtools/reset-machine-ifdisconnecteduser.ps1

As you’ll learn from below this script should be run on the legacy site against the old desktop. Performs the following actions:

  • Get list of users in an ad group
  • Get list of users disconnected from Citrix desktop
  • Compare lists and create new list that match both
  • Take action: Reset machine if user is both in ad group and disconnected state
output of powershell script

Tale of two desktops

I’ve put this to good use when migrating a large Citrix desktop user base that operates 24-7. The above, in addition to StoreFront site aggregation, have published the same desktop twice, one in legacy site another on new site.

By adding an ad group to the new desktop on the new site and having the new site placed higher in site aggregation in addition to the desktop having the same name as the legacy site new and current users will now connect to the new desktop in the ad group.

The hang up is current users will not return to their old desktop with that desktop being in a disconnected state. To prevent trouble this PowerShell script can be coded to run in a loop and check every minute or so to reset machines for these given users.

Final thoughts

Your now free to add people at will to the new ad group to start using the new desktop on the new site. If someone has an old desktop they disconnect from and are entitled to the new desk the old with be reset and new is ready for connection.

Virtualize Brief


Follow