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

Re: Need a script to reboot VM if uptime is more than 1 days

$
0
0

hope this would help you.

 

Get-Stat -Entity $vms -Stat sys.uptime.latest -Realtime -MaxSamples 1 |

Select @{N='VM';E={$_.Entity.Name}},@{N='Uptime';E={[math]::Round((New-Timespan -Seconds $_.Value).TotalHours)}} |

where{$_.Uptime -gt 24} | %{

    Get-VM -Name $_.VM |

    Restart-VM -Confirm:$false

}

 

as per LUC you do a replacement. Hope I am correct


Viewing all articles
Browse latest Browse all 230613

Trending Articles



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