Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 49146

Re: Select only one result out of many - Get-VIEvent

$
0
0

You could do something like this

 

$userName='domain\user'

Get-Cluster"clustername"|

Get-VM|

Get-VIEvent-Type "Info"|

Where{$_.UserName-eq$username}|

Sort-Object-Property CreatedTime -Descending |

Group-Object-Property {$_.VM.Name}|

ForEach-Object-Process {

   $_.Group| Select -First 1|

  Select @{Name='Name';E={$_.vm.name}}, CreatedTime, UserName

}


Viewing all articles
Browse latest Browse all 49146

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>