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.

Orion.Nodes CustomPropertyValues

All,

     I am really new to powerorion and we see something we would like to stream line, windows updates outage windows. Where we could pull the nodes on certain custom properties, Update_Schedule in my case, and set them as unmanaged for x hours.

     I know there is already a tool to do this, but it is an awful process. So, I ask you, is there a way to do this?

if I go to Orion.Nodes (view) in the database I see Update_Schedule in the view but when I try to pull from it I get an error. The only thing I can figure is the SwisData has hardcoded  variables in it and will not allow me to select a custom field. Any help on this would be great!

Get-SwisData $swis "SELECT sysname FROM Orion.Nodes WHERE Update_Schedule Like 'DEV%'"

  • hey,

    i think they only issue with selecting the fields was because you needed the Orion.NodesCustomProperties table, try this:

    # Parameters 

    $orionServer = "localhost" 

    $orionUsername = "user" 

    $orionPassword = "password"

    #Get snapin

    if (! (Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) {

    Add-PSSnapin "SwisSnapin"

    }

    # Connect to SWIS 

    $swis = Connect-Swis -Hostname $orionServer -UserName $orionUsername -Password $orionPassword 

    # search nodes etc

    Get-SwisData $swis "select SysName from orion.nodes n inner join Orion.NodesCustomProperties np on n.nodeid = np.nodeid where np.Update_Schedule like 'DEV%'"

  • this should do the unmanaging for you over red that part lol.. this will un-mange for 2 minutes

    # Parameters

    $orionServer = "localhost"

    $orionUsername = "username"

    $orionPassword = "password"

    #Get snapin

    if (! (Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) {

    Add-PSSnapin "SwisSnapin"

    }

    # Connect to SWIS

    $swis = Connect-Swis -Hostname $orionServer -UserName $orionUsername -Password $orionPassword

    # search nodes etc

    $nodid = Get-SwisData $swis "select SysName from orion.nodes n inner join Orion.NodesCustomProperties np on n.nodeid = np.nodeid where np.Update_Schedule like 'DEV%'"

    $now = [DateTime]:: UtcNow

    $later = $now.AddMinutes(2)

    Invoke-SwisVerb $swis Orion.Nodes Unmanage @("N: $nodeid ", $now, $later, "false")

    More information can be found here:

    Orion SDK with PowerShell - manage/unmanage multiple nodes

  • Thank you for your help in this. We were able to clean it up a little by doing the following: Adding -Trusted to the connection string passes the username and password and allows for use to use a service account.

    # Parameters
    $orionServer = "ServerName"

    #Get snapin
    if (! (Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) {
    Add-PSSnapin "SwisSnapin"
    }

    # Connect to SWIS
    $swis = Connect-Swis -trusted -Hostname $orionServer

    # search nodes et
    Get-SwisData $swis "select SysName, from orion.nodes n inner join Orion.NodesCustomProperties np on n.nodeid = np.nodeid where np.Update_Schedule like 'DEV%'"

    $now = Get-Date

    $later = $now.AddHours(2)

    Invoke-SwisVerb $swis Orion.Nodes Unmanage @("N: $nodeid ", $now, $later, "false")

    You have been a great help. My biggest problem was the inner join. Thank you so much!