I am working on a power shell script to add nodes. Everything works to add the node except for when I try to call the AddInterfacesOnNode. When I send the request I get the following error:
Invoke-RestMethod : "Expecting state 'Element'.. Encountered 'Text' with name '', namespace ''. "
Anyone else run across this error when trying to add an interface using powershell and not the powershell module?
Below is the JSON and the code that I am try to use to get the interface added.
[
4519,
{
"ifIndex": 10101,
"Caption": "GigabitEthernet0/1 - Gi0/1",
"ifType": 6,
"ifSubType": 0,
"InterfaceID": 0,
"Manageable": true,
"ifSpeed": 0.0,
"ifAdminStatus": 0,
"ifOperStatus": 4
},
"AddDefaultPollers"
]
#
function AddInterfacesOnNode ($nID, $nodeInterface){
$URI = $URL+"Invoke/Orion.NPM.Interfaces/AddInterfacesOnNode/"
$intBody = @($nID,$nodeInterface,"AddDefaultPollers")| ConvertTo-Json
$msgBody = $intBody
write-host $msgBody
$result = Invoke-RestMethod -Uri $URI -Method POST -Body $msgBody -Credential $credential -ContentType "application/json"
Write-Log -Message "Successfully added interface $properties.caption" -Severity Information -Details $result
return $result
}
#