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.
I was going to test and saw the latest comment it doesn't work in vSphere 7.
I'm going to test myself and report back to you.
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
You need to include or dot-source that function before calling it.
How did you run that call?
Yes, these are the functions that you first need to dot-source or include in your script
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.
Do you have the Perennially Reserved set to True on those LUNs?
If not, rescans might take a lot longer for these LUNs.
Negative no reserves.
They are using the Nimble PSP policy though.