I am looking for a script thats will list the security policy for the vDS Portgroups. I installed the vDSPowerCli but keep getting this error. Works for 32bit powershell, but not on 64bit.
Add-PSSnapin : The Windows PowerShell snap-in 'VMware.VimAutomation.VdsComponent' is not installed on this machine.
At E:\Scripts\HealthCheck - Pramod\dvswitch_1.ps1:1 char:13
+ Add-PSSnapin <<<< VMware.VimAutomation.VdsComponent
+ CategoryInfo : InvalidArgument: (VMware.VimAutomation.VdsComponent:String) [Add-PSSnapin], PSArgumentExcepti
on
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
Any solution?
With the Export-Csv cmdlet.
Something like this
&{foreach($dvSw in Get-VirtualSwitch -Distributed){ Get-VirtualPortGroup -Distributed -VirtualSwitch $dvSw |
Select @{N="dvSw Name";E={$dvSw.Name}},
@{N="dvSw AllowPromiscuous";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value}},
@{N="dvSw ForgedTransmits";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value}},
@{N="dvSw MacChanges";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.MacChanges.Value}},
@{N="dvPg Name";E={$_.Name}}, @{N="dvPg AllowPromiscuous";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value}},
@{N="dvPg ForgedTransmits";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value}},
@{N="dvPg MacChanges";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.MacChanges.Value}} }} | Export-Csv C:\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Are you using VDSPowerCLI with PowerCLI 4.1.1 ?
As one of the authors of the fling notes, the snapin is based on PowerCI 4.1.1.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
we are using 5.0.1. Is there a way to make it work on 64bit?
is there a script to list security policy for vDS vswitches and portgroup?
thanks in advance.
You can do that with PowerCLI itself, no need to install DVSPowerCLI for that.
foreach($dvSw in Get-VirtualSwitch -Distributed){ Get-VirtualPortGroup -Distributed -VirtualSwitch $dvSw |
Select @{N="dvSw Name";E={$dvSw.Name}},
@{N="dvSw AllowPromiscuous";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value}},
@{N="dvSw ForgedTransmits";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value}},
@{N="dvSw MacChanges";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.MacChanges.Value}},
@{N="dvPg Name";E={$_.Name}},
@{N="dvPg AllowPromiscuous";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value}},
@{N="dvPg ForgedTransmits";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value}},
@{N="dvPg MacChanges";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.MacChanges.Value}} }
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I don't think the DVSPowerCLI snapin is supported on a 64-bit client for now.
And afaik there is no method to make it work, it's caused by the way the snapin is written I'm afraid.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks LucD. How do we output this to a csv file?
Wish you a happy new year.
Thanks
With the Export-Csv cmdlet.
Something like this
&{foreach($dvSw in Get-VirtualSwitch -Distributed){ Get-VirtualPortGroup -Distributed -VirtualSwitch $dvSw |
Select @{N="dvSw Name";E={$dvSw.Name}},
@{N="dvSw AllowPromiscuous";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value}},
@{N="dvSw ForgedTransmits";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value}},
@{N="dvSw MacChanges";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.MacChanges.Value}},
@{N="dvPg Name";E={$_.Name}}, @{N="dvPg AllowPromiscuous";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value}},
@{N="dvPg ForgedTransmits";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value}},
@{N="dvPg MacChanges";E={$_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.MacChanges.Value}} }} | Export-Csv C:\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The cmdlets available in that snapin shouldn't be required anymore.
The latest PowerCLI builds include a number of dvSwitch cmdlets.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference