County of vMotion and Storage vMotion over the last 24 hours

I am under the below a line to count the number of vMotion and Storage vMotion, which happened in the past 24 hours in the middle and it not give me the required result, but when I combine them in the script that I use to collect additional information, it's just returns 0 (zero) as the County.

Rely on Storage vMotion and vMotion

Get-VIEvent - MaxSamples ([int]: MaxValue)-start (Get-Date). AddDays(-1) |

Where {$_.} GetType(). {Name - eq "TaskEvent" - and $_.Info.DescriptionId - eq "VirtualMachine.relocate" - or $_.Info.DescriptionId - eq "StorageResourceManager.applyRecommendation"} |

Measure-object | Select-Object - ExpandProperty County

Get-VIEvent - MaxSamples ([int]: MaxValue)-start (Get-Date). AddDays(-1) |

Where {$_.} GetType(). {Name - eq "TaskEvent" - and $_.Info.DescriptionId - eq "VirtualMachine.migrate"} |

Measure-object | Select-Object - ExpandProperty County

Combined script

Get-Cluster |

{ForEach-Object

$Cluster = $_

$VMHost = $Cluster | Get-VMHost

$CpuUsageMhz = $VMHost | Measure-object-property CpuUsageMhz-sum | Select-Object - ExpandProperty sum

$CpuTotalMhz = $VMHost | Measure-object-property CpuTotalMhz-sum | Select-Object - ExpandProperty sum

$MemoryUsageGB = $VMHost | Measure-object-property MemoryUsageGB-sum | Select-Object - ExpandProperty sum

$MemoryTotalGB = $VMHost | Measure-object-property MemoryTotalGB-sum | Select-Object - ExpandProperty sum

$Cluster | Select-Object - property @{Name = "ClusterName"; Expression = {$_.} Name}},

@{Name = 'vSphere HA'; Expression = {$_.} HAEnabled}},

@{Name = 'Analysis HA-Host'; Expression = {$_.} ExtensionData.Configuration.DasConfig.HostMonitoring}},

@{Name = 'HA-Failover capacity'; Expression = {$_.} ExtensionData.Summary.CurrentFailoverLevel}},

@{Name = 'HA-Admission Control'; Expression = {$_.} HAAdmissionControlEnabled}},

@{Name = 'Configuration problem'; Expression = {[string]: join (",", ($_.))} ExtensionData.ConfigIssue | {{(Select-ExpandProperty FullFormattedMessage))}}.

@{Name = 'vSphere DRS'; Expression = {$_.} DrsEnabled}},

@{Name = "The DRS automation level"; Expression = {$_.} DrsAutomationLevel}},

@{Name = "Use of the CPU (Mhz)"; Expression is {$CpuUsageMhz}},

@{Name = "Cpu (Mhz) Total"; Expression is {$CpuTotalMhz}},

@{Name = 'Cpu use (%) » ; {Expression = {[Math]: Round(100*$CpuUsageMhz/$CpuTotalMhz)}},

@{Name = "use (GB) of memory"; Expression is {$MemoryUsageGB}},

@{Name = "Total (GB) of memory"; Expression is {$MemoryTotalGB}},

@{Name = 'use of memory (%) » ; {Expression = {[Math]: Round(100*$MemoryUsageGB/$MemoryTotalGB)}},

@{Name = 'VMS NB'; Expression = {$_ |} Get - VM | Measure-object | {{Select-Object - ExpandProperty County}},

@{Name = 'Virtual machines without VMXNET3 NB'; Expression = {$_ |} Get - VM | Get-NetworkAdapter | WHERE-object {$_.} Type - not "Vmxnet3"} | Measure-object | {{Select-Object - ExpandProperty County}},

@{Name = 'VMotions NB'; Expression = {$_ |} Get-VIEvent - MaxSamples ([int]: MaxValue)-start (Get-Date). AddDays(-1) | Where {$_.} GetType(). {Name - eq "TaskEvent" - and $_.Info.DescriptionId - eq "VirtualMachine.migrate"} | Measure-object | {{Select-Object - ExpandProperty County}},

@{Name = 'SvMotions NB'; Expression = {$_ |} Get-VIEvent - MaxSamples ([int]: MaxValue)-start (Get-Date). AddDays(-1) | Where {$_.} GetType(). {Name - eq "TaskEvent" - and $_.Info.DescriptionId - eq "VirtualMachine.relocate" - or $_.Info.DescriptionId - eq "StorageResourceManager.applyRecommendation"} | Measure-object | {{Select-Object - ExpandProperty County}}

} |

Export-Csv "C:\Script\Clusters.csv" - NoTypeInformation - UseCulture

Could you please someone check the script above and let me know if there is something wrong

Thank you!!

But wait a minute, you mean that the "Num vMotions" and "Num of SvMotions" properties have a value of 0?

This is normal, since you ask for events for the entity of the group, while you should do it for all the virtual machines in the cluster.

Try the attached version.

Tags: VMware

Similar Questions

Maybe you are looking for

  • Toshiba Video Player - corrupt downloaded the zip file

    To the right: The following zip file is damaged. Please check. FTP - URL vidpl - 20150211140640.zipDate last modified 11/02/15Toshiba companyType of video playerSubtype (none)Size (KB) 148050455Version 5.3.49.124Universal languageCountries world wide

  • How to allocate memory for string

    How to allocate memory in LabVIEW for char []? The table is: char ProjectName [260]. I still have 4 lu byte string Unflatten, suggestions? TIA.

  • Problem with the seizure of power play xbox games to xbox 360 arcade

    http://www.Microsoft.com/download/en/details.aspx?displaylang=en&ID=12129#system-requirements I followed above link to see how to make my Xbox 360 arcade able to play xbox games. I did what he said, but it does not work. I have downloaed the file cal

  • 5U875 windows ultimate 64-bit DEVICE driver

    Hi, I use a laptop computer Sony Vaio VGN-FW510D with a windows 7 Ultimate 64-bit edition. The device drivers in my laptop detects a device as a 5U875 device, for which I am not able to install the drivers for the same that I tried the Sony link down

  • BlackBerry DESKTOP MANAGER Smartphones settles

    I downloaded the software Blackberry 4.7 but when I tried to install it; unzip the files, the installation starts then window marked "intall windows" appears. I have the only option is 'ok' I select and closed of the instalation. and the software is