Schaedle
Enthusiast
Enthusiast

get datastore connectivity status

Jump to solution

Dear @ll,

Im searching for a powercli (maybe oneliner if short) snippet to get this information here:

datastore.jpg

Great would be to get the Mount Point with the setup alias instead of the "cryptic" path. But this is not so important.

Thanks Wolfgang

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

Not really a one-liner (of which I'm not a fan btw :smileygrin:), but this should return the info.

Not sure what you mean by 'setup alias'?
If you mean the symbolic link with the datastore name instead of the GUID, that is only available when the datastore is connected afaik.

Get-View -ViewType Datastore -PipelineVariable ds | ForEach-Object -Process {

    $ds.Host | ForEach-Object -Process {

        New-Object -TypeName PSObject -Propert ([ordered]@{

            Datastore = $ds.Name

            Host = (Get-View -Id $_.Key -Property Name).Name

            Mounted = if($_.MountInfo.Mounted){'Mounted'}else{'Unmounted'}

            'Datastore Connectivity' = if($_.MountInfo.Accessible){'Connected'}else{'Not Connected'}

            'Mount Point' = $_.MountInfo.Path

        })

    }

}


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership

Not really a one-liner (of which I'm not a fan btw :smileygrin:), but this should return the info.

Not sure what you mean by 'setup alias'?
If you mean the symbolic link with the datastore name instead of the GUID, that is only available when the datastore is connected afaik.

Get-View -ViewType Datastore -PipelineVariable ds | ForEach-Object -Process {

    $ds.Host | ForEach-Object -Process {

        New-Object -TypeName PSObject -Propert ([ordered]@{

            Datastore = $ds.Name

            Host = (Get-View -Id $_.Key -Property Name).Name

            Mounted = if($_.MountInfo.Mounted){'Mounted'}else{'Unmounted'}

            'Datastore Connectivity' = if($_.MountInfo.Accessible){'Connected'}else{'Not Connected'}

            'Mount Point' = $_.MountInfo.Path

        })

    }

}


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

View solution in original post

0 Kudos
Schaedle
Enthusiast
Enthusiast

Thank you LucD so much for your help Smiley Happy

I thought this should be possible with the get-view cmdlet but I'm absolutely not conform using this in the right way.

0 Kudos