Making sure your Citrix Desktops are utilized with Powershell v2

powershellIn my post from April on Making sure your Citrix Desktops are utilized in 35 lines of PoSH I mentioned I would be looking to expand the powershell script and I’ve added just a few lines of code to do that expantion.

 

The v1 version of the powershell script was able to grab all the desktops that were inactive for x amount of days (30 in my example) and emails the end user.

With this v1.1 release it will grab all the desktops that haven’t been used within x amount of days, notify the user and set the desktop to maintenance mode effectively making sure that the desktop can’t be used anymore. There’s an “if” statement added which will remove the desktop from the machine catalog if the desktop is older than 30 days and already in maintenance mode. 

 

As said before I had to use the Office 365 SMTP servers hence why you’d see the additional parameters for SSL, Creds and ports. This might be different for your own environment, also you need to make sure that the account you’re using to send the email has send-as rights for the alias you’re using for the -from parameter. This piece of script fetches all assigned desktops in a XD site, determines the last logon time and if it’s longer than 30 days it will collect the user assigned to the desktop all while utilizing posh cmdlets. Based on the user AD will be queried and the email address will be fetched to send out an email. So far, so good.. Result!

PoSH

 

The following two tabs change content below.

Kees Baggerman

Kees Baggerman is a Staff Solutions Architect for End User Computing at Nutanix. Kees has driven numerous Microsoft and Citrix, and RES infrastructures functional/technical designs, migrations, implementations engagements over the years.

4 comments

  1. […] Catalogs > Maintenance – added link to CTP Kees Baggerman’s script to Make sure Citrix Desktops are utilized […]

  2. […] Baggerman has a script at Making sure your Citrix Desktops are utilized with Powershell v2 that does the […]

  3. […] Catalogs > Maintenance – added link to CTP Kees Baggerman’s script to Make sure Citrix Desktops are utilized […]

  4. […] Making sure your Citrix Desktops are utilized with Powershell v2 […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.