Checking power settings on VMs using powershell

Nutanix AHVOne of the customers I was engaged with ran into an issue where Citrix Studio was throwing out power commands towards Prism and Nutanix AHV but the VMs didn’t always respond properly. After some investigation it turned out we ran into the issue described here. Now obviously Citrix has best practices to disable screensavers on the VM side and optimize power managent but if you’re doing persistent desktops you might want a way to report which desktops aren’t optimized before taking any action, right? In my case I decided to write a short powershell script to get those VMs.

One of the issues I faced was that I had a lot more AD objects than actual VMs so to prevent loss of time I wanted to do a cross reference on the VMs I had running on my infrastructure vs the AD-objects. 

My thoughts process here:

  1. Collect the VMs running on the virtual infrastructure.
  2. Collect the Client OS based AD Objects
  3. Cross reference those lists
  4. Turn on the VMs that are in both lists
  5. Check the settings for each of the VMs that exist in the final list.
  6. Report back if a connection could be made and what the actual settings where.

I’ve ran the script inside my environment and it got the job done, the goal of this blogpost/powershell script is to document the script and to show how you can save time by cross referencing multiple sources before actually going out and process a number of items that are irrelevant. 

Here’s how the script outputs to the console:

Powershell
Script output

Next step would be to output this to a CSV or HTML file so you can go around showing the report and take action based on the report. As you’ve seen from previous scripts it should be simple to output this to HTML and set actions for the VMs that aren’t fully optimized. 

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.

Leave a Reply

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