Showing results for 
Search instead for 
Did you mean: 

Unmanage All Nodes with a Specified Custom Property Value

Unmanage All Nodes with a Specified Custom Property Value

The attached allows you to Unmanage a group of nodes that share a custom property value in common. This is useful when you plan to take an entire site down for maintenance, or if you have a scheduled patching routine you'd like to automate.

Using the Orion SDK you can accomplish this using PowerShell. For example:

     $swis = Connect-Swis -hostname XXX -username YYY -password ZZZ

     $nodes = Get-SwisData $swis "SELECT N.Uri FROM Orion.Nodes N WHERE N.CustomProperties.Foo = @bar" @{ bar = "my value" }

     $nodes | Set-SwisData $swis @{ Unmanaged = $true; UnmanageFrom = [DateTime]::UtcNow; UnmanageUntil = [DateTime]::UtcNow.AddHours(4) }

The above is a simplified example of the logic someone might use to accomplish this by unmanaging all nodes which have the Custom Property ‘Foo’ set with the value of ‘bar’.  Once complete, you would then use the Scheduled Task Manager to run this PowerShell script on a regularly scheduled basis. 

Attached is a more practical implementation which should serve as a proof of concept. Simply run:

     ‘UnmanageByCustomProperty.ps1 -server {orion server name or IP address} -customProperty "{custom property name}" -value “{custom property value}"

Note: The Orion username and password is hardcoded within the script and should be changed to match your environment.


Hi aLTeReGo,

  Could you please help for the script that shows:

1. Audit events variables

2. If possible:  AD authentication ID information

Thank you in advance.

Version history
Revision #:
1 of 1
Last update:
‎12-07-2016 12:24 PM
Updated by: