Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $vcHost = "virtual.center.host"
  2. $vcClusterName = "Your ClusterName"
  3. $vcUser = "username"
  4. $vcPass = "password"
  5.  
  6. $vcServer = Connect-VIServer -Server:$vcHost -User:$vcUser -Password:$vcPass -WarningAction:SilentlyContinue
  7.  
  8. $vmHosts = Get-Datacenter | Get-Cluster -Name:$vcClusterName | Get-VMHost | Sort
  9.  
  10. ForEach ($vmHost in $vmHosts) {
  11.     If (Get-VMHostStorage -VMHost:$vmHost -Refresh -ErrorAction:SilentlyContinue -WarningAction:SilentlyContinue) {
  12.         Write-Host $vmHost.Name," host storage information refreshed"
  13.     } else {
  14.         Write-Host $vmHost.Name," host storage refresh failed!"
  15.     }
  16. }
  17.  
  18. Disconnect-VIServer -Server:$vcServer -Confirm:$false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement