Hi All,
I'm new to powercli and I was trying to export the list of security groups along with their members in excel file. I am trying to run the below script but its not working. I gave domain as default but it threw below error. Any idea what i'm doing wrong here?
Connect to NSX-T Manager
Connect-NsxtServer -Server "NSX_URL"
# Get all security groups and their members
$securityGroups = Invoke-ListGroupForDomain | ForEach-Object {
$groupName = $_.display_name
$groupMembers = Invoke-GetGroupIPMembers -SecurityGroup $_
[PSCustomObject]@{
GroupName = $groupName
Members = $groupMembers.Member
}
}
# Prepare data for CSV
$csvData = $securityGroups | Select-Object GroupName, Members
# Export to CSV
$csvPath = "C:\NSX\NSXT_SecurityGroups.csv"
