Thursday, January 5, 2017

PowerShell / PowerCLI Powered On / Off Report Using HTML & CSS

I recently was tasked with creating a report containing the current power state for all VM's in a vCenter environment. Using some recently obtained CSS knowledge and revisiting PowerShell HTML reports, I whipped this little gem up:

That's it. All you need to do is modify the PowerState to either:

  • PoweredOn
  • PoweredOff
and or point to another external CSS for formatting. I find it easier to use a URL between the single quotes. I modified the script to strip away any custom settings for my environment. 

Here's an example of the external CSS file I used (reportstyle.css) : 

With these you can create simple reports from vcenter data that look like this: