I'm trying to use this code snippet to loop through the VLAN interfaces on routers to change IP Helper addresses. The problem is that the InterfaceName property includes a dash in the name so you can't use it in a script.
For example It returns VLAN-10 instead of VLAN10
Anyone have a work around? I need to get this script working for a couple hundred switches before the weekend change.
Thanks!
// Loop through selected interfaces
foreach (@interfaceItem in @ContextNode.Interfaces)
{
if (@interfaceItem.InterfaceName contains 'VLAN')
{
CLI
{
interface @interfaceItem.InterfaceName
}
CLI
{
ip helper-address 10.0.252.10
ip helper-address 10.0.252.11
no ip helper-address 10.101.6.158
no ip helper-address 10.101.6.159
no ip helper-address 157.142.8.10
}
CLI
{
exit
}