cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 7

Cannot get interface caption using discovery through PowerShell and DiscoverInterfacesOnNode verb

Hi,

I am trying to do some automatic interface additions based on interface type and on interface name. I have slightly modified the PowerShell example to discover interfaces on nodes in order to get it working, however, when it comes down to Caption, the value is "Caption" for *all* interfaces. Am I missing a special option in order to get the proper interface name, or is this not supported? I have tried to get more documentation on the DiscoverInterfacesOnNode or DiscoveredLiteInterface XML output, but I haven't had any luck there either.

This is an copy from the script output:

> & 'C:\Program Files (x86)\SolarWinds\Orion SDK\Samples\PowerShell\NPM.DiscoverAndAddInterfacesOnNode.ps1'

Id          : 3

ifIndex     : 1

Caption     : Caption

ifType      : 6

ifSubType   : 0

InterfaceID : 50653

Manageable  : true

ifSpeed     : 0

Id          : 5

ifIndex     : 2

Caption     : Caption

ifType      : 6

ifSubType   : 0

InterfaceID : 50664

Manageable  : true

ifSpeed     : 0

Id          : 7

ifIndex     : 3

Caption     : Caption

ifType      : 6

ifSubType   : 0

InterfaceID : 0

Manageable  : true

ifSpeed     : 0

[...]

If its not possible, is there a better way to get the interface name prior to importing it?


Thanks!

0 Kudos
8 Replies
Level 9

Did you ever get to resolve this issue? I am also having the same problem. Querying interfaces but their captions only show the "Caption" value, instead of the actual name. When I "List Resources" on Orion, they all show fine.

0 Kudos

Hi,

The value of caption is returned correctly by the verb but its type is recognized as XmlElement in powershell.

Use $discovered.DiscoveredInterfaces.DiscoveredLiteInterface[0].Caption.InnerText to get the actual value.

Thanks a lot madhavan. That did it fine. Please excuse the n00bness!

0 Kudos

mulder85gr‌ - what version of NPM? And what kind of device are you querying?

0 Kudos

NPM Version is 11.5.2.  I've tried both Windows (SNMP) and Cisco nodes and still getting the same issue: "Caption" as the value of Caption.

0 Kudos
Level 19

Can you show your modified version of the script?

Also, what version of NPM are you using? And if you do a "List Resources" on that device in the web console, do the interfaces show up correctly?

0 Kudos

I also forgot to add that I tried with the SDK v1.10 and 1.9, in case it helps. I'd be more than willing to try with a different language with a little bit of help, if ever you have a hard time reproducing.

0 Kudos

Hi,

We are using NPM 11.0.1 and yes, if I do a "List Resources", all of the interfaces are properly named.

Here is the modified script:

# Load Snapin

Add-PSSnapin SwisSnapin

# Connect to SWIS

$hostname = "host"

$username = "user"

$password = "pass" | ConvertTo-SecureString -AsPlainText -Force

$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password

$swis = Connect-Swis -host $hostname -cred $cred

# The node ID to discovery interfaces on

$nodeId = 1676

# Discover interfaces on the node

$discovered = Invoke-SwisVerb $swis Orion.NPM.Interfaces DiscoverInterfacesOnNode $nodeId

if ($discovered.Result -ne "Succeed") {

  Write-Host "Interface discovery failed."

}

else {

  # Filter the resulting list to include only ifType 131 (Tunnel)

  $discovered.DiscoveredInterfaces.DiscoveredLiteInterface |? {$_.ifType -ne 131} |% { $discovered.DiscoveredInterfaces.RemoveChild($_) | Out-Null }

  $discovered.DiscoveredInterfaces.DiscoveredLiteInterface

  # Add the remaining interfaces

  #Invoke-SwisVerb $swis Orion.NPM.Interfaces AddInterfacesOnNode @($nodeId, $discovered.DiscoveredInterfaces, "AddDefaultPollers") | Out-Null

}

Thanks again

0 Kudos