I need a powercli script that will detect an inactive NFS datastore and remount it. These datastores can become inactive by a wide variety of reasons to include: the switch the NFS vmnic is connected rebooted; an accidental change on the NFS filer temporarily makes a mount unavailable; a network cable being accidentally pulled.
I currently have an NFS datastore that is down (by virtue of a switch reboot), showing up in the vsphere client as greyed out , italicized, prepended with "(inactive) (unmounted)". However, using powercli to check the attributes of the datastore show .State=Available and .Accessible=True.
In esxcli, there's a command esxcfg-nas -r which restores all NAS mounts. I attempted to leverage this via PowerCLI Get-ESXcli, but the $esxcli.storage.nfs options don't seem to contain a reconnect option.
Is there another way to find inaccessible datastores and reconnect them via powercli? The only other place I can think to do this would be via the get-view to try and match the inactive datastores but it's messy. Additionally, could we submit a request to engineering for a way to detect inactive datastores?