jakas
Contributor
Contributor

VMware.VimAutomation.VdsComponents

Jump to solution

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?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

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

View solution in original post

0 Kudos
8 Replies
LucD
Leadership
Leadership

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

0 Kudos
jakas
Contributor
Contributor

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.

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
jakas
Contributor
Contributor

thanks LucD. How do we output this to a csv file?

Wish you a happy new year.

Thanks

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
esxi1979
Expert
Expert

VDSPowerCli need a 32 bit os ?

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos