A set of functions to allow you to unmount/mount and detach/attach datastores from multiple hosts.
List all datastores and their mount/detach status by passing your datastore object(s) into the Get-DatastoreMountInfo advanced function as shown below:
To unmount a datastore pass your datastore object(s) to the Unmount-Datastore advanced function as seen below, this will unmount the datastore from all attached hosts:
Once unmounted you will then be able to detach the datastore from the hosts using the Detach-Datastore cmdlet as shown below:
Script download
Forward from