VMware Cloud Community
jason89s
Contributor
Contributor
Jump to solution

Auditing Read-Only NFS Mounted Datastores

Hi all,

I've been looking for a cmdlet or function that would return whether an NFS volume is mounted in read/write or read-only mode on a node.  The use case for this is looping through a vCenter to ensure volumes that should be mounted as read-only weren't accidentally mounted as read/write during a node rebuild.  I haven't yet found anything that returns this value.

Is there anything available in PowerCLI that will provide this information?

Thanks,

Jason

Tags (3)
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

foreach($ds in (Get-Datastore | where {$_.Type -eq "NFS"})){
   
$ds.ExtensionData.Host |
   
Select @{N="DS";E={$ds.Name}},
     
@{N="RemoteHost";E={$ds.RemoteHost}},
     
@{N="RemotePath";E={$ds.RemotePath}},
     
@{N="ESXi";E={Get-view $_.Key -Property Name | Select -ExpandProperty Name}},
     
@{N="AccessMode";E={$_.MountInfo.AccessMode}}
}

If you only want to see the read-only ones, you can add a Where-clause


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

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

foreach($ds in (Get-Datastore | where {$_.Type -eq "NFS"})){
   
$ds.ExtensionData.Host |
   
Select @{N="DS";E={$ds.Name}},
     
@{N="RemoteHost";E={$ds.RemoteHost}},
     
@{N="RemotePath";E={$ds.RemotePath}},
     
@{N="ESXi";E={Get-view $_.Key -Property Name | Select -ExpandProperty Name}},
     
@{N="AccessMode";E={$_.MountInfo.AccessMode}}
}

If you only want to see the read-only ones, you can add a Where-clause


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

jason89s
Contributor
Contributor
Jump to solution

This is exactly what I was looking for, thanks!

Jason

Reply
0 Kudos