Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

Set-SwisObject : The given key was not present in the dictionary.

$
0
0

Hi, I try to update Alias/Comments for IP but I get error: Set-SwisObject : The given key was not present in the dictionary.

 

Import-Module SwisPowerShell

 

[String]$swisConnectHost = 'localhost'

[String]$swisConnectUserName = 'admin'

[String]$swisConnectPassword = ''

[String]$targetSubnet = '10.0.0.0'

[String]$targetSubnetCIDR = '24'

[string]$IPHostname = 'VM-test-01'

[string]$IPComments = 'Reserved by ServiceNow'

 

$swis = Connect-Swis -UserName $swisConnectUserName -Password $swisConnectPassword -Hostname $swisConnectHost

 

$IP = Invoke-SwisVerb $swis IPAM.SubnetManagement StartIpReservation @($targetSubnet, $targetSubnetCIDR, "0") -Verbose

 

try {

    Invoke-SwisVerb -SwisConnection $swis -EntityName IPAM.SubnetManagement -Verb ChangeIpStatus @($IP, "Blocked") -Verbose

} Catch {

    $_.Exception.ExceptionMessage

}

 

 

try {

    Invoke-SwisVerb -SwisConnection $swis -EntityName IPAM.SubnetManagement -Verb FinishIpReservation @($IP, "Reserved") -Verbose

} Catch {

    $_.Exception.ExceptionMessage

}

 

 

$IPtoIdQuery = "SELECT IpNodeId FROM IPAM.IPNode where IPAddress like '"+ $($Ip.'#text') +"'"

$IPAMNode =  Get-SwisData -SwisConnection $swis -Query $IPtoIdQuery

$URI = 'swis://localhost/Orion/IPAM.IPNode/IpNodeId='+$IPAMNode

 

# Setting IP Node properties needed Admin rights

Set-SwisObject $swis -Uri $URI -Properties @{ Comments = $IPComments }

 

It's very simple operation, I don't know what is wrong. Please help.


Viewing all articles
Browse latest Browse all 2677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>