10-24-2016 12:00 PM
I am trying to use Power tool to add VLANs to Port Channel Members in lieu of using VLAN Manager. Pleaser review the command below as I am getting an error on the VLAN parameter
Add-UcsVlanMemberPortChannel -vlan APP_PRD_NLB_2_VLAN090 -PortId 7 -AdminSpeed 10gbps -IsNative no -Name PO207A -SwitchId A
Add-UcsVlanMemberPortChannel : Cannot bind parameter 'Vlan'. Cannot convert the "APP_PRD_NLB_2_VLAN090" value of type
"System.String" to type "Cisco.Ucsm.FabricVlan".
At line:1 char:36
+ Add-UcsVlanMemberPortChannel -vlan APP_PRD_NLB_2_VLAN090 -PortId 7 -A ...
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Add-UcsVlanMemberPortChannel], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Cisco.Ucsm.Cmdlets.AddUcsVlanMemberPortChannel
Any ideas?
Solved! Go to Solution.
10-25-2016 12:47 AM
Hi Charles,
You need to pass a FabricVlan object as input to the vlan parameter instead of just the name of the vlan.
You can do something like this
Get-UcsVlan -Name test | Add-UcsVlanMemberPortChannel -PortId 7 -SwitchId A -AdminSpeed 10gbps -IsNative no -Name Test
AdminSpeed : 10gbps
AdminState : enabled
Descr :
EpDn :
IfRole : storage
IfType : aggregation
IsNative : no
Locale : external
Name : Test
OperSpeed : 10gbps
OperState : indeterminate
PeerDn :
PortId : 7
Sacl :
StateQual :
SwitchId : A
Transport : ether
Type : lan
Warnings :
Ucs : savbu-tpi03
Dn : fabric/lan/net-test/pc-switch-A-pc-7
Rn : pc-switch-A-pc-7
Status : created
XtraProperty : {}
Refer online help available for the cmdlet for more details on the parameters.
Get-Help Add-UcsVlanMemberPortChannel
NAME
Add-UcsVlanMemberPortChannel
SYNOPSIS
Adds Managed Object of type FabricEthVlanPc.
SYNTAX
Add-UcsVlanMemberPortChannel -FabricNetGroup <FabricNetGroup> [-PortId]
<uint> [-SwitchId] <string> [-AdminSpeed <string>] [-AdminState <string>]
[-Descr <string>] [-IsNative <string>] [-Name <string>] [-OperSpeed
<string>] [-ModifyPresent] [-XtraProperty <Hashtable>] [-Ucs
<UcsHandle[]>] [<CommonParameters>]
Add-UcsVlanMemberPortChannel -Vlan <FabricVlan> [-PortId] <uint>
[-SwitchId] <string> [-AdminSpeed <string>] [-AdminState <string>] [-Descr
<string>] [-IsNative <string>] [-Name <string>] [-OperSpeed <string>]
[-ModifyPresent] [-XtraProperty <Hashtable>] [-Ucs <UcsHandle[]>]
[<CommonParameters>]
DESCRIPTION
Adds Managed Object of type FabricEthVlanPc. Represents an association
between a VLAN and an Ethernet port channel. This MO is added as a child
of fabric:Vlan and indicates the specified Ethernet port channel should
carry the VLAN ID of the parent fabric:Vlan.
Hope this helps. Let us know if you need further assistance on this.
Thanks,
Sumanth
10-25-2016 12:47 AM
Hi Charles,
You need to pass a FabricVlan object as input to the vlan parameter instead of just the name of the vlan.
You can do something like this
Get-UcsVlan -Name test | Add-UcsVlanMemberPortChannel -PortId 7 -SwitchId A -AdminSpeed 10gbps -IsNative no -Name Test
AdminSpeed : 10gbps
AdminState : enabled
Descr :
EpDn :
IfRole : storage
IfType : aggregation
IsNative : no
Locale : external
Name : Test
OperSpeed : 10gbps
OperState : indeterminate
PeerDn :
PortId : 7
Sacl :
StateQual :
SwitchId : A
Transport : ether
Type : lan
Warnings :
Ucs : savbu-tpi03
Dn : fabric/lan/net-test/pc-switch-A-pc-7
Rn : pc-switch-A-pc-7
Status : created
XtraProperty : {}
Refer online help available for the cmdlet for more details on the parameters.
Get-Help Add-UcsVlanMemberPortChannel
NAME
Add-UcsVlanMemberPortChannel
SYNOPSIS
Adds Managed Object of type FabricEthVlanPc.
SYNTAX
Add-UcsVlanMemberPortChannel -FabricNetGroup <FabricNetGroup> [-PortId]
<uint> [-SwitchId] <string> [-AdminSpeed <string>] [-AdminState <string>]
[-Descr <string>] [-IsNative <string>] [-Name <string>] [-OperSpeed
<string>] [-ModifyPresent] [-XtraProperty <Hashtable>] [-Ucs
<UcsHandle[]>] [<CommonParameters>]
Add-UcsVlanMemberPortChannel -Vlan <FabricVlan> [-PortId] <uint>
[-SwitchId] <string> [-AdminSpeed <string>] [-AdminState <string>] [-Descr
<string>] [-IsNative <string>] [-Name <string>] [-OperSpeed <string>]
[-ModifyPresent] [-XtraProperty <Hashtable>] [-Ucs <UcsHandle[]>]
[<CommonParameters>]
DESCRIPTION
Adds Managed Object of type FabricEthVlanPc. Represents an association
between a VLAN and an Ethernet port channel. This MO is added as a child
of fabric:Vlan and indicates the specified Ethernet port channel should
carry the VLAN ID of the parent fabric:Vlan.
Hope this helps. Let us know if you need further assistance on this.
Thanks,
Sumanth
10-25-2016 08:27 AM
Thank you Sumanth! This works perfectly. From this I was able to build the following short scripts for assigning VLANs to all the locations required in our environment. Hope this helps others!
$ucs = "ucs"
$vlan_list = import-csv "c:\scripts\ucsvlans.txt"
connect-ucs $ucs
foreach ($vlan in $vlan_list) {
get-ucslancloud | add-ucsvlan -Name $vlan.Name -Id $vlan.Id -DefaultNet "no"
}
$ucs = "ucs"
$vlan_list = import-csv "c:\scripts\ucsvlans_vswitch1.txt"
connect-ucs $ucs
foreach ($vlan in $vlan_list) {
get-ucsvlan -Name $vlan.name | add-UcsVlanMemberPortChannel -PortId 7 -AdminSpeed 10gbps -IsNative no -Name PO207A -SwitchId A
get-ucsvlan -Name $vlan.name | add-UcsVlanMemberPortChannel -PortId 8 -AdminSpeed 10gbps -IsNative no -Name PO208B -SwitchId B
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide