Select Page

The other day I had a drive go out on me. When a drive is lost the VMs will still be shown in the vSphere client, but they will be marked as inaccessible.

I created the following PowerCLI script to list all the VMs marked as inaccessible so I could go back and recreate and/or restore them later.

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Connect-VIServer  -Server 10.0.0.99 -user administrator@vsphere.local -password mypassword

(Get-View -ViewType VirtualMachine) | ?{$_.Runtime.ConnectionState -eq “invalid” -or $_.Runtime.ConnectionState -eq “inaccessible”} | Format-List-AutoSize

 

Social Share Buttons and Icons powered by Ultimatelysocial