The closest article I have found is the following... https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-fu...
But someone reported this fails on vSphere 7. Anyone had successful scripts that work for targeting a Datacenter or cluster?
I don't mind splitting them up.
Here is the error...
Get-DatastoreMountInfo : The term 'Get-DatastoreMountInfo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:47
+ ... acenter -name London | Get-Datastore | Get-DatastoreMountInfo | Sort ...
+ CategoryInfo : ObjectNotFound: (Get-DatastoreMountInfo:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Thanks again this worked great! Thanks again LucD!!!
At some point when I decomm another SAN in the future I'd like to work on looping this. That way it runs down my list with pauses. The detach takes about 3-5 seconds per host. Then the unmount takes 3-5 seconds. Times that by 45 LUNs x 14 hosts... it was a few hours of running them 1 LUN at a time.