PowerCLI Quick Tip: Get VM Uptime


Well, technically, it’s not uptime, it’s “last boot time”, but you know what I mean. I think this is much more useful than the number of seconds since the last boot anyway…

$LastBootProp = @{
  Name = 'LastBootTime'
    Expression = {
      ( Get-Date ) - ( New-TimeSpan -Seconds $_.Summary.QuickStats.UptimeSeconds )
Get-VM | Get-View | select Name, $LastBootProp

In case you are curious, a “quick tip” means that I don’t have time to write a longer post. Smile Hey, it’s better than not sharing!

Leave a Reply

Your email address will not be published.