Removing a Datastore with PowerCLI/Powershell

Another issue that comes along with power outages? Hosts coming back up before their storage… With fiber channel, you can typically reconnect it with a refresh/rescan, but with NFS, they tend to become disconnected.

The fix is to remove and re-add the Datastore (see kb 1005057)

With no way to handle them en masse in the gui and no desire to have to repeat this process in the future, I used Powershell!

Here is the raw script, I will add comments in the near future for those interested.

I chose to run this per cluster