VMware Cloud Community
Virtualduty
Enthusiast
Enthusiast
Jump to solution

Script to run checks to unmount the datastore

I found this awesome function authored by LucD online. However I am not familiar with using functions. Can it be run as a ps1 ? Also how do I specify the datastore names, say Datastore 1, Datastore 2 , Datastore 3 in this script ? And if my understanding is correct the function mentioned in the below link will just run the checks and NOT unmounts anything. Please help to confirm.

Test if the datastore can be unmounted - LucD notes

Thanks in advance !

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Yes, place the function in a .ps1 file, and at the end of the file, place the call to the function.

You can specify more than 1 datastore on the Datastore parameter,

Get-DatastoreUnmountStatus -Datastore MyDS1,MyDS2

and you also call the function in a pipeline construct

Get-Datastore | Get-DatastoreUnmountStatus

I attached a sample .ps1 file.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Yes, place the function in a .ps1 file, and at the end of the file, place the call to the function.

You can specify more than 1 datastore on the Datastore parameter,

Get-DatastoreUnmountStatus -Datastore MyDS1,MyDS2

and you also call the function in a pipeline construct

Get-Datastore | Get-DatastoreUnmountStatus

I attached a sample .ps1 file.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
David2021
Contributor
Contributor
Jump to solution

Hello LucD,

Regarding your script Get-DatastoreUnmountStatus which is very good, I have few points :

1 - How I can set a specify order of column for Datastore, NoVM, NoDastoreClusterMember, NosDRS, NoSIOC, NoHAheartbeat, NovdSwFile, NoScratchPartition. Currently, if I rename in the script the order of column change randomly without sens and no alphabetical order.

2 - The check Datastore Hearbeat is based on which of these 3 options ?
- Automatically select datastores accessible from the hosts (normaly is the default option on ESXi cluster)
- Use datastores only from the specified list
- Use datastores from the specified list and complement automatically if needed
Or other points ?
Because I have a datastore which for that point NoHAheartbeat is "False" but there is nothing particular regarding the other datastores with the result "True"

regarding,
David

Reply
0 Kudos