Hi - I have a PowerShell script to discover interfaces which has been working fine but is now suddenly throwing .Net exceptions, I wondered if anyone had any ideas what is going on or how I can fix it?
Code is as follows:
This bit works fine & I get the nodeID back:
# Ensure Machine exists in Solar Winds
$myNodeID = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE NodeID='$nodeID'"
if ($nodeID -eq $null) {
Write-Output "Error - device NodeID $nodeID does not exist in Solar Winds"
exit 0
}
Write-Output "nodeID: $myNodeID"
This throws an exception:
# Discover interfaces on the node
$discovered = Invoke-SwisVerb $swis Orion.NPM.Interfaces DiscoverInterfacesOnNode $nodeId
if ($discovered.Result -ne "Succeed") {
Write-Host "Error - Interface discovery failed."
}
Exception:
Invoke-SwisVerb : SolarWinds.JobEngine.WorkerProcess.JobExecutionException: System.ArgumentNullException: Value cannot be null.
Parameter name: credentials
at SolarWinds.Orion.Pollers.Framework.SettingsHelper.ValidateCredentials[TCredentials](Credential credentials)
at SolarWinds.Orion.Pollers.Framework.SNMP.SnmpInventoryBase.DoInventory(GlobalSettingsBase globalSettings, SettingsBase nodeSettings, InventorySettingsBase inventorySettings, Credential credentials)
at SolarWinds.NPM.DiscoveryPlugin.Activities.InterfacesSnmpInventoryStep.DoNpmDiscovery(NpmDiscoveryConfiguration cfg)
at SolarWinds.NPM.DiscoveryPlugin.NPMLiteDiscoveryPlugin.<DoDiscovery>d__0.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at SolarWinds.NPM.Jobs.DiscoveryJob.Execute(IJobExecutionHost host)
at SolarWinds.JobEngine.WorkerProcess.Job2Adapter.Execute(IInternalJobExecutionHost host)
at SolarWinds.JobEngine.WorkerProcess.Job2Adapter.Execute(IInternalJobExecutionHost host)
at SolarWinds.JobEngine.WorkerProcess.JobDecorator.Execute(IInternalJobExecutionHost host)
at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJobSynchronously(ActiveJob activeJob)
at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJob(ActiveJob activeJob)
at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.WorkItemDispatched(Object state)
at SolarWinds.JobEngine.WorkerProcess.Job2Adapter.Execute(IInternalJobExecutionHost host)
at SolarWinds.JobEngine.WorkerProcess.JobDecorator.Execute(IInternalJobExecutionHost host)
at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJobSynchronously(ActiveJob activeJob)
at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJob(ActiveJob activeJob)
at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.WorkItemDispatched(Object state)
At D:\AegisScripts\SolarWinds\DiscoverInterfaces.ps1:38 char:30
+ $discovered = Invoke-SwisVerb <<<< $swis Orion.NPM.Interfaces DiscoverInterfacesOnNode $nodeId
+ CategoryInfo : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1
+ FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb