With all the fuss going round about the latest Linux vulnerability you will probably get a request from your local Security Officer to produce a report which of your Linux systems are vulnerable to the Shellshock bug. And, seen there are already several known exploits, who can blame him for asking such a report.
Since a lot of these Linux boxes are running under vSphere, we can use PowerCLI to produce such a report. The Invoke-VMScript cmdlet is the vehicle I use in the following function. With the Invoke-VMScript cmdlet it is very easy to execute, what is considered the best test to check for the vulnerability.
Update2 September 29 2014: the 2nd test from the Shellshocker gives a syntax error. The test is replaced by the one found on Michael Boelen‘s website in How to protect yourself against Shellshock Bash vulnerability. Big thanks to for the pointer.
Update1 September 29 2014: the function was updated to include tests for most of the known Shellshock vulnerabilities. The tests were collected from the Shellshocker site.
Continue reading PowerCLI and the Linux Shellshock vulnerability
Finding out which performance counters are available on your vSphere server over which time interval, is not always an easy task. There is of course the Performance Manager entry in the VMware vSphere API Reference, but that is not always the easiest task. Let alone finding out what a specific counter actually represents.
For that reason I decided to create a tool, which I called the Stats Toolbox, that would query the vSphere server to get the actual list of counters it collects for each interval. In the tool I added some extra features that would make working with the performance counters easier.
During our VMworld 2014 US breakout session I demonstrated the features of the Stats Toolbox, and I received quite some positive feedback.
Continue reading Stats Toolbox – A vSphere Server Performance Counter tool
One of the questions, related to working with vSphere events and tasks, that often appear in the PowerCLI Community, is how do we know which events to select for a query.
To make that task a bit easier, I wrote the Event-O-Matic script. It’s a GUI that allows you to pick a number of events, and the script will generate the PowerShell code, and place it in the clipboard. The Event-O-Matic script was mentioned during our VMworld 2013 US session VSVC4944.
Update September 7th 2013:
- added at least PowerShell v3 test
- added PowerCLI core pssnapin loaded test
Continue reading Event-O-Matic
Another interesting question in the PowerCLI Community today.
David wanted to know if it was possible to track which VMs had been failed over to another ESXi host by HA.
With the Get-VIEventPlus function from my Get the vMotion/svMotion history post it is easy to get that informatiom from the Tasks and Events that are kept in the vCenter database.
But which event to look for ?
Continue reading HA VM failover tracking
When you need to move the content of one or more datastores, you sometimes stumble upon files that you didn’t know where there. One such type of files are dump files that are stored in a VM’s directory on the datastore.
The files I encountered were named like this:
There isn’t a lot of information available on what exactly these files are used for, besides that they seem to be created when the VM Monitor encounters a crash or a serious problem.
Since these files were quite old, and since I didn’t have any open tickets with VMware, I decided to remove these files. But of course in the PowerCLI way with a function 😉
Continue reading Remove old VM monitor dump files
The availability of vMotion and svMotion, provided you have a license that allows it, in vSphere are some of its key features.
The DRS and SDRS functionality will use vMotion and svMotion to better use the available resources.
And you as a vSphere administrator can use it to facilitate your work. Just think of how easy patching or datastorecluster maintenance becomes with the help of these two features.
But as an administrator you want to be able to report on what vMotion and svMotion have been doing over a specific time interval in your vSphere environment.
In the past I already provided a vMotion reporting tool in Events – Part 8 – vMotion history, but now it was time to provide a universal (s)vMotion reporting feature.
Update October 29th 2013: added additional parameters to the Get-VIEventPlus function
- User: one or more users for which to return the events
- System: a switch to return all system user events
- ScheduledTask: return all events for a specific Scheduled Task
Update February 10th 2014: it’s always nice to see another implementation based on one of your scripts. The Opvizor solution will soon contain this function, see Dennis Zimmer‘s post called Storage vMotion Activities Report ! Continue reading Get the vMotion/svMotion history
Another post triggered by a question in the VMTN PowerCLI community. The user wanted to know how he could create a report that showed for which vSphere entities the alarm actions were disabled.
To set the stage, a short overview of what this is all about. In vSphere you can, since vSphere 4, disable and enable alarm actions for all the managed entities. This option is available from the vSphere client
and from the vSphere Web client.
But how to automate these actions, and more importantly in this case, how to report on the active settings ? Like always PowerCLI to the rescue.
Continue reading Alarm actions – enable – disable – report
One of the exciting new dvSwitch features in vSphere 5.1 is the ability to export and restore a dvSwitch configuration. This new feature is only available through the vSphere Web Client.
On Hypervisor.fr, a blog you should have in your RSS reader, there were already posts on how to configure the dvSwitch healthcheck and how to do a dvSwitch configuration rollback from PowerCLI. But till now, as far as I know, there were no functions to provide the dvSwitch export/restore functionality.
Time to make this useful functionality available for the “PowerCLI automation crowd” 😉
Continue reading dvSwitch scripting – Part 13 – Export/Restore Config
One of the hot new features in vSphere 5 was the introduction of SDRS. And with SDRS came the concept of affinity rules for VMs and VMDKs. Cormac, aka @VMwareStorage, posted a nice overview of the SDRS affinity rules in Storage DRS Affinity & Anti-Affinity Rules.
Since then several posts have appeared on the subject of SDRS affinity rules. To list just a few:
Currently there are no PowerCLI cmdlets to define the inter- and intra-vm anti-affinity rules for SDRS. After a question in the VMTN PowerCLI Community I decided to write a function. This function will allow you to automate the creation of the SDRS anti-affinity rules.
Continue reading Automate your SDRS Anti-Affinity rules
Another post that comes from a VMTN PowerCLI Community question. Jeff wanted to find the free SCSI LUNs in his environment.
While answering that thread I was amazed there was no PowerCLI function written yet to provide this functionality. At least that was what my friend Google told me 😉
Since there exists a SDK method that makes retrieving free SCSI LUNs quite easy, the function I came up with isn’t too complex.
But it should help you in further automating the setup of your datastores.
Continue reading Find free SCSI LUNs