This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

PowerShell script to modify a NODE Custom Property via Rest API/JSON

I needed this for a side project and i'm placing this script here. It gives a baseline to modify a node's custom property via PowerShell and SWIS without the need to install the SDK. The baseline can be modified/imported into any current POSH script.

The end goal was the change a Node Custom Property called 'SendAlert' to either true(Yes) or false(No). Then use this custom property in the alert engine to "toggle" when nodes are allowed to alert. There are a lot of variables at play so the "Time of Day" scenario didn't quite fit.

You'll need to pass the node ID, ${Node.ID}, into the script.

In the alert trigger condition, in the scope section, i added the custom property.

2016-09-08 09_05_12-Edit Alert - _ SMS_Slack Alert me when a Node has an issue (custom)_.png

Here is another link that goes into more detail around setting up a Custom Property in an alert.

I also have an example of how to change a APPLICATION custom property via Rest API.

PowerShell script to modify an APPLICATION Custom Property via Rest API/JSON

SWIS_Rest_API_Modify_CP_Node.ps1
Parents
  • created the .ps1 file in desktop with above mentioned script.

    Right click on .ps1 file and run With powershell.

    Script asked for Press "YES"

    pastedImage_0.png

    And then script is asking to username and password.

    pastedImage_1.png

    post provide the credential, we are not getting any error, for success and failure.

    but when i am checking the node's custom property, update is not available.

    thank

    K

Reply
  • created the .ps1 file in desktop with above mentioned script.

    Right click on .ps1 file and run With powershell.

    Script asked for Press "YES"

    pastedImage_0.png

    And then script is asking to username and password.

    pastedImage_1.png

    post provide the credential, we are not getting any error, for success and failure.

    but when i am checking the node's custom property, update is not available.

    thank

    K

Children
No Data