vSAN Storage Policy Summary using PowerCLI

I recently came across a need to review the Storage Policies in use within a vCenter environment and how many objects or virtual machines where using each policy. I saw this as an excuse to refresh my PowerShell skills and wrote a quick function. Source code can be found on my GitHub, here. Check there for any updates but below is the code at the time of writing. function Get-vSANSPSummary { <# .SYNOPSIS Export vSAN Storage Policy Information. .DESCRIPTION Export vSAN Storage Policies from vCenter showing FTT & Stripe information and amount of amount of VM's using each. .PARAMETER ExportPath Path the export the output HTML file. .NOTES Tags: VMware, vCenter, SPBM, PowerCLI, API Author: Stephan McTighe Website: stephanmctighe.com .EXAMPLE PS C:\> Get-vSANSPSummary -ExportPath "C:\report\vSAN-Storage-Policy-Summary.html" Outputs a HTML file containing the Storage Policy Information for vSAN Storage Policies to a specified location. #> #Requires -Modules VMware.VimAutomation.Storage [CmdletBinding()] param ( [Parameter(Mandatory)] [string] $ExportFilePath) Begin {} Process { try { $Output = @() $vSANstoragepolicies = Get-SpbmStoragePolicy -Namespace "VSAN" $SPBM = $vSANstoragepolicies | Select-Object Name, AnyOfRuleSets ForEach ($SP in $SPBM) { $Attributes = @( $SP | ForEach-Object { $_.AnyOfRuleSets } | Select-Object -ExpandProperty AllofRules) $object = [PSCustomObject]@{ SPName = $SP.Name ObjectCount = $ObjectCount = (Get-SpbmEntityConfiguration -StoragePolicy "$($SP.name)").count VMCount = $VMCount = (Get-SpbmEntityConfiguration -StoragePolicy "$($SP.Name)" | Where-Object {$_.Entity -notlike "hard*"}).count RAID = $attributes | Where-Object { $_.Capability -like "*VSAN.replicaPreference*" } | Select-Object -ExpandProperty Value FTT = $attributes | Where-Object { $_.Capability -like "*VSAN.hostFailuresToTolerate*" } | Select-Object -ExpandProperty Value SubFTT = $attributes | Where-Object { $_.Capability -like "*VSAN.subFailuresToTolerate*" } | Select-Object -ExpandProperty Value Stripes = $attributes | Where-Object { $_.Capability -like "*VSAN.stripeWidth*" } | Select-Object -ExpandProperty Value ForceProvision = $attributes | Where-Object { $_.Capability -like "*VSAN.forceProvisioning*" } | Select-Object -ExpandProperty Value StorageType = $attributes | Where-Object { $_.Capability -like "*VSAN.storageType*" } | Select-Object -ExpandProperty Value IOPSLimit = $attributes | Where-Object { $_.Capability -like "*VSAN.iopsLimit*" } | Select-Object -ExpandProperty Value } $Output += $object } $Output | ConvertTo-Html -Property SPName, VMCount, ObjectCount, RAID, FTT, SubFTT, Stripes, ForceProvision, StorageType, IOPSLimit | Out-File $ExportFilePath } catch { Write-Host "An error occurred!" -ForegroundColor Red Write-Host $_ -ForegroundColor Red } } } Output currently as a basic HTML table but you could change this to add some ‘HTMLness’ or output to CSV.

NSX-T Edge Node 3.2 Upgrade Issue - Hugepage Support

I recently did the first NSX upgrade in my Homelab! My Lab is running older hardware, HPE DL380 Gen8’s to be exact and this lead to an upgrade issue when attempting to upgrade my Edge node! Here is the error I was faced with: Edge 3.2.0.0.0.19067356/Edge/nub/VMware-NSX-edge-3.2.0.0.0.19067362.nub switch OS task failed on edge TransportNode c7aa6c6e-1a49-423a-a5c2-87cfa0ba9e1c: clientType EDGE , target edge fabric node id c7aa6c6e-1a49-423a-a5c2-87cfa0ba9e1c, return status switch_os execution failed with msg: An unexpected exception occurred: CommandFailedError: Command ['chroot', '/os_bak', '/opt/vmware/nsx-edge/bin/config.py', '--update-only'] returned non-zero code 1: b"lspci: Unable to load libkmod resources: error -12nlspci: Unable to load libkmod resources: error -12\nlspci: Unable to load libkmod resources: error -12\nlspci: Unable to load libkmod resources: error -12\nlspci: Unable to load libkmod resources: error -12\nSystem has not been booted with systemd as init system (PID 1). Can't operate.\nERROR: Unable to get maintenance mode information\nNsxRpcClient encountered an error: [Errno 2] No such file or directory\nWARNING: Exception reading InbandMgmtInterfaceMsg from nestdb, Command '['/opt/vmware/nsx-nestdb/bin/nestdb-cli', '--json', '--cmd', 'get', 'InbandMgmtInterfaceMsg']' returned non-zero exit status 1.\nINFO: Corelist count is rounded to 2 from 3\nERROR: NSX Edge configuration has failed. **1G hugepage support required**\n" . This thread on VMTN provided the answer and an explanation, so I won’t repeat that here but I did want to share this.