Hi Luc,
Need your help in redcuing the script run time. I've created the below script to combine powernsx and powercli to get the report that i wanted, But it is taking hours to complete the report. Can this be tweaked by changing anything?
I have 8 Nsx server so it is taking 9hrs to complete. 😞
$report =@()
$cred = get-credential
Get-Module -ListAvailable | where{$_.Name -match "vmware*"} | Import-Module
Import-Module PowerNSX
foreach ($test in $nsx){
Connect-NsxServer $test -Username admin -Password xxxxxx -VICred $cred
$sectags = Get-NsxSecurityTag |where {$_.vmcount -ne "0"} | foreach{$_.name}
foreach ($tag in $sectags){
$data = Get-NsxSecurityTag -Name $tag | Get-NsxSecurityTagAssignment | select Virtualmachine
$data | Add-Member -Name "Security Tag" -Value $tag -MemberType NoteProperty
$data | Add-Member -Name "Server" -Value $test -MemberType NoteProperty
$report += $data
}
Disconnect-NsxServer
}