-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
When I am using this module in my script and calling the script from the commandline I am getting the following error.
New-Object : Cannot find type [VNVDTrafficFilterPolicyConfig]: verify that the assembly containing this type is loaded.
At C:\Program Files\WindowsPowerShell\Modules\vNugglets.VDNetworking\1.1.0\GetItems.ps1:22 char:4
+ New-Object -Type VNVDTrafficFilterPolicyConfig -Property ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
This only happens when I am calling the script from the windows console or powershell but does not occur when I am running the script from within powershell ISE.
I have found that the offending line is
Get-VDSwitch -name $VDSwitchName | Get-VDPortGroup -name $VDPortGroup | Get-VNVDTrafficFilterPolicyConfig
Why is this happening and how could I solve this ?
For testing I am running this small test script, after installing vNugglets.VDNetworking.
import-module vNugglets.VDNetworking
Connect-VIServer -Server $serverip -Protocol https -User $username -Password $pass
get-vdswitch -name $vswitch | get-vdportgroup -name $vport | get-vnvdtrafficfilterpolicyconfig