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.

More from my site

  • Managing vSAN internet connectivity configuration using the vSAN API
  • Quick Tip - Retrieving the vSAN Rekey Interval using PowerCLI
  • Retrieving detailed per-VM space utilization on VSAN
  • Translating vSAN VM Object IDs (UUID to VM and VM to UUID)
  • Reporting vSAN Object distribution across vSAN Disk Groups using PowerCLI

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

  • Crowdsourced Lab Hardware for ESXi 9.0 Dashboard 06/17/2025
  • Automating the vSAN Data Migration Pre-check using vSAN API 06/04/2025
  • VCF 9.0 Hardware Considerations 05/30/2025
  • VMware Flings is now available in Free Downloads of Broadcom Support Portal (BSP) 05/19/2025
  • VMUG Connect 2025 - Minimal VMware Cloud Foundation (VCF) 5.x in a Box  05/15/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...