Hello,
I would like to add/update the Orion node with PowerShell Rest API using Json data type. I want to know if any one has any sample code that I can look at.
Thank you in advance.
CluM09
If you want to add a node from PowerShell, I recommend following one of these two samples:
https://github.com/solarwinds/OrionSDK/blob/master/Samples/PowerShell/CRUD.AddNode.ps1
https://github.com/solarwinds/OrionSDK/blob/master/Samples/PowerShell/DiscoverSnmpV3Node.ps1
If you want to use JSON, I would recommend switching to Python and following one of these two samples:
https://github.com/solarwinds/orionsdk-python/blob/master/samples/add_node.py
https://github.com/solarwinds/orionsdk-python/blob/master/samples/discover_one_node.py
Thank you for the response.
Currently I add the server node to the Orion SAM 6.2.2 using the swis snapin, but I want to switch to using the Rest API instead because I don't want run the swis snap fro another server or installed the swis snapin on the local computer during the server deployment.
I just wan to use the rest api with json which is natively supported by the Windows PowerShell that came with the Windows servers. Python is good for Linux/Unix platform of operating system which I seldom deploy in our company.
I hope to use the rest api with json to accomplish the task of adding Windows WMI node to SolarWinds Orion SAM during the deployment process so that I don't have to have another server with the swis snapin installed that I need to call during the server deployment. If rest api with json can allow me to add the server WMI node to SolarWInds Orion SAM, I can just call the api directly from the server during the deployment which can simplify the task even when I move the deployment to the cloud.
The REST API will work fine. Just put together a hash making up all the things you want to define about your new node and then hand it off to the Invoke-RestMethod cmdlet as the body of the request. Something like this:
$properties = @{ 'IPAddress' = '192.168.21.1'; 'EngineID' = 1; # more properties here}Invoke-RestMethod -Uri "">yourip:17778/.../Create" -Method POST -Body $body -Credential $credential -ContentType "application/json"
BTW, this also has the issue with the SSL certificate from your other thread.