WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Hardware Options
    • Hardware Reviews
    • Lab Deployment Scripts
    • Nested Virtualization
    • Homelab Podcasts
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Quick Tip - Retrieving vSAN File Share Network Permissions using vSAN API & PowerCLI

Quick Tip - Retrieving vSAN File Share Network Permissions using vSAN API & PowerCLI

10.16.2024 by William Lam // Leave a Comment

When creating a new vSAN File Share, which is powered by vSAN File Services,  additional network access controls (no access, allow access from any IP or custom) can be configured.


To view the configured network permissions, users must expand each file share to get the relevant information. For those interesting in automating the retrieval of this information for reporting and/or compliance purposes, you can use the vSAN Management API and specifically the vSAN queryFileShares() API.

The vSAN File Share API can also be consumed through PowerCLI using the Get-VsanFileShare cmdlet, but the network permission configuration is not part of the default output which might lead users to believe this information is not available.

In addition to the default fields from the Get-VsanFileShare cmdlet, we can retrieve the network permissions by looking at the FileShareNetworkPermission property, which will contain one or more entries.

Here is a quick PowerCLI snippet that you can use to retrieve all vSAN File Shares along with their Hard/Soft Quota, Used Capacity and Network Permissions:

$fileShares = Get-VsanFileShare

$results = @()
foreach ($fileShare in $fileShares) {

    $fileSharePermissions = $fileShare.FileShareNetworkPermission

    $permissions = ""
    foreach ($fileSharePermission in $fileSharePermissions) {
        $permissions += "$($fileSharePermission.IPSetOrSubnet),$($fileSharePermission.VsanFileShareAccessPermission),$($fileSharePermission.AllowSquashRoot)`n"
    }

    $tmp = [pscustomobject] [ordered]@{
        Name = $fileShare.Name
        SoftQuotaGB = $fileShare.SoftQuotaGB
        HardQuotaGB = $fileShare.HardQuotaGB
        UsedCapacityGB = $fileShare.UsedCapacityGB
        Permissions = $permissions
    }
    $results += $tmp
}

$results

Here is an example output for the three vSAN File Shares I have defined and their respective network permissions.

Categories // Automation, PowerCLI, VSAN Tags // PowerCLI, VSAN

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • VCF 9.0 Hardware BOM for Silicon Valley VMUG 07/18/2025
  • Clearing resource locks with VCF 9.0 Installer 07/17/2025
  • Workaround for single NIC using NFS storage with VCF 9.0 07/15/2025
  • Quick Tip - Updating Firmware on Minisforum MS-A2 07/14/2025
  • Ultimate Lab Resource for VCF 9.0 06/25/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...