Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 192300

Re: Index was outside the bounds of the array - Get-VirtualPortGroup

$
0
0

PowerCLI C:\Requests> &{foreach($sw in (Get-VirtualSwitc

h -Standard)){

>>   foreach($VPG in &{

>>     Get-Process -Id $PID

>>     Try {

>>       Get-VirtualPortGroup -VirtualSwitch $sw

>>     }

>>     Catch {

>>       Get-Process -Id $PID

>>       $_ | Select *

>>       $_.Exception.InnerException | Select *

>>     }}){

>>     $VPG |

>>

>>   Select @{N="Host";E={$sw.VMHost.Name}},

>>   @{N="Switch";E={$sw.Name}},

>>   @{N="Promiscuous mode";E={if($sw.Extensiondata.Spec.Policy.Security.AllowPr

omiscuous) {"NonCompliant"} Else {"Complaint"}}},

>>   @{N="Forged transmits";E={if($sw.Extensiondata.Spec.Policy.Security.ForgedT

ransmits){"NonCompliant"} Else {"Complaint"}}},

>>   @{N="MAC Changes";E={if($sw.Extensiondata.Spec.Policy.Security.MacChanges){

"NonCompliant"} Else {"Complaint"}}},

>>   @{N="Portgroup";E={$VPG.Name}},

>>   @{N="Portgroup Promiscuous mode";E={if($VPG.Extensiondata.Spec.Policy.Secur

ity.AllowPromiscuous -eq $null) {if($sw.Extensiondata.Spec.Policy.Security.Allow

Promiscuous) {"NonCompliant"} Else {"Complaint"}} Else {if($VPG.Extensiondata.Sp

ec.Policy.Security.AllowPromiscuous) {"NonCompliant"} Else {"Complaint"}}}},

>>   @{N="Portgroup Forged transmits";E={if($VPG.Extensiondata.Spec.Policy.Secur

ity.ForgedTransmits -eq $null)  {if($sw.Extensiondata.Spec.Policy.Security.Forge

dTransmits)  {"NonCompliant"} Else {"Complaint"}} Else {if($VPG.Extensiondata.Sp

ec.Policy.Security.ForgedTransmits)  {"NonCompliant"} Else {"Complaint"}}}},

>>   @{N="Portgroup MAC Changes";E={if($VPG.Extensiondata.Spec.Policy.Security.M

acChanges -eq $null) {if($sw.Extensiondata.Spec.Policy.Security.MacChanges){"Non

Compliant"} Else {"Complaint"}} Else {if($VPG.Extensiondata.Spec.Policy.Security

.MacChanges){"NonCompliant"} Else {"Complaint"}}}},

>>   @{N="NoNativeVlan1";E={if($VPG.vLanID -eq 1) {"NonCompliant"} Else {"Compla

int"}}},

>>     @{N="NoReservedVlans";E={if(($VPG.vLanID -ge 3968 -and $VPG.vLanID -le 40

47) -or ($VPG.vLanID -eq 4094)) {"NonComplaint"} Else {"Compliant"}}},

>> @{N="NoVGTvlan4095";E={if($VPG.vLanID -eq 4095){"NonComplaint"} Else {"Compla

int"}}},

>> @{N="LabelVswitches";E={if (!$vSwitch.Name) {"NonComplaint"} Else {"Complaint

"}}}

>>

>> }}}

>>

 

 

 

 

Host                       : TestESX1.Domain.Com

Switch                     : vSwitch0

Promiscuous mode           : Complaint

Forged transmits           : Complaint

MAC Changes                : Complaint

Portgroup                  : powershell

Portgroup Promiscuous mode : Complaint

Portgroup Forged transmits : Complaint

Portgroup MAC Changes      : Complaint

NoNativeVlan1              : Complaint

NoReservedVlans            : Compliant

NoVGTvlan4095              : Complaint

LabelVswitches             : NonComplaint

 

 

Host                       : TestESX2.Domain.Com

Switch                     : vSwitch0

Promiscuous mode           : Complaint

Forged transmits           : Complaint

MAC Changes                : Complaint

Portgroup                  : PortGrpA

Portgroup Promiscuous mode : Complaint

Portgroup Forged transmits : Complaint

Portgroup MAC Changes      : Complaint

NoNativeVlan1              : Complaint

NoReservedVlans            : Compliant

NoVGTvlan4095              : Complaint

LabelVswitches             : NonComplaint

 

 

 

As I Said, Couldn't able to see PID

 

 

PowerCLI C:\IA\Requests> $pid

6036

I'm getting Process ID


Viewing all articles
Browse latest Browse all 192300

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>