Tag Archives: vmware

PowerCLI: Function for listing snapshots

My very first PowerCLI related post was about this same topic: listing snapshot info using PowerCLI. In my original post (which you can see here) I only wrote a pretty simple one-liner. Which was kind of okay, but it was … Continue reading

Posted in PowerCLI, Powershell, VMware Tagged , , , , , , ,

PowerCLI: Evacuating a datastore

In case you ever need to empty out a datastore in you vmware environment, there is a nice little one-liner in PowerCLI for that: Get-VM -Datastore “datastore1” | Move-VM -Datastore (Get-VMHost -Location ‘cluster1’ | Select-Object -First 1 | Get-Datastore | … Continue reading

Posted in PowerCLI, Powershell, VMware Tagged , , , ,

PowerCLI: Listing VMs with ISOs mounted

For almost a year ago, I posted a simple one-liner to list all VMs who has ISOs mounted. You can view that post here: http://cloud.kemta.net/2013/10/powershell-vmware-list-all-vms-with-iso-mounted-and-dismount-them/ That post was written before I truly discovered the major advantages of using Get-View instead of … Continue reading

Posted in PowerCLI, Powershell, VMware Tagged , , , , , ,

PowerCLI: Getting vmhost uptime

I love a powershell challenge, and last week a colleague of mine asked me for assistance in getting the uptime of vmware hosts. My initial response did the trick: Get-View  -ViewType hostsystem -Property name,runtime.boottime | Select-Object Name, @{N=”UptimeDays”; E={((((get-date) – … Continue reading

Posted in PowerCLI, Powershell, VMware Tagged , , , , , ,

PowerCLI: Getting the status of vmware tools on all VMs

I’m sure I don’t need to explain to you guys why VMware tools is a good idea to have installed on your VMs, and probably not why it’s a good idea to keep VMware tools updated. However, I haven’t found … Continue reading

Posted in PowerCLI, Powershell, VMware Tagged , , , , ,

PowerCLI: Getting datastore alarms

Next in the series on getting alarms is getting datastore alarms. Again, the code is pretty similar: $Datastores = Get-View -ViewType Datastore -Property Name,OverallStatus,TriggeredAlarmstate $FaultyDatastores = $Datastores | Where-Object {$_.TriggeredAlarmState -ne “{}”} $progress = 1 $report = @() if ($FaultyDatastores … Continue reading

Posted in PowerCLI, Powershell, VMware Tagged , , , , ,

PowerCLI: Getting cluster alarms

The next step in my short series on getting vCenter alarms using PowerCLI is to get cluster alarms. Here’s the code: $Clusters = Get-View -ViewType ComputeResource -Property Name,OverallStatus,TriggeredAlarmstate $FaultyClusters = $Clusters | Where-Object {$_.TriggeredAlarmState -ne “{}”} $report = @() $progress … Continue reading

Posted in PowerCLI, Powershell, VMware Tagged , , , , ,

PowerCLI: Getting host alarms

Yesterday I wrote a post about getting vm alarms through PowerCLI. Today it’s time for getting host alarms The code is very similar to the one for getting vm alarms, since they both use get-view to grab all info: $VMHosts … Continue reading

Posted in PowerCLI, Powershell, VMware Tagged , , , , ,

PowerCLI: Getting vm alarms

A few weeks ago I started to put together a health check script for our vmware environments and the first thing I wanted to have in that report is a list of triggered alarms. To my surprise there was no … Continue reading

Posted in PowerCLI, Powershell, VMware Tagged , , , , ,

PowerCLI: Consolidate all VMs that need consolidation

Robert van den Nieuwendijk has a nice post on how to use PowerCLI to find VMs that need consolidation and then how to start consolidation. You can that post here: http://rvdnieuwendijk.com/2012/09/26/use-powercli-to-consolidate-snapshots-in-vsphere-5/ But, as always, I prefer to make a function of … Continue reading

Posted in PowerCLI, Powershell, VMware Tagged , , , ,