Quantcast
Viewing all articles
Browse latest Browse all 224018

Re: Resetting HardwareStatus via PowerCLI

You would probably want to write that more along the lines of the below:

 

$user = "root"

$password = "Password"

$vmhosts = Get-VMHost | Select Name

Foreach ($vmhost in $vmhosts){

    Write-Host "Processing "$vmhost.Name

    Connect-VIServer $vmhost.Name -User $user -Password $password | Out-Null

    $HealthSystem = (Get-View (Get-VMHost | Get-View).ConfigManager.HealthStatusSystem)

    $HealthSystem.ResetSystemHealthInfo()

    $HealthSystem.UpdateViewData()

    $HealthSystem.RefreshHealthStatusSystem()

    Disconnect-VIServer -Confirm:$false

    Write-Host "Starting Next Host"

}

 

 

If you run that as script while connected to your vCenter it will pull all of your hosts and connect directly to them to refresh them.


Viewing all articles
Browse latest Browse all 224018

Trending Articles



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