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 scripts to automatically unmanage\remanage a node using the Orion SDK

Hi All,

I am trying to unmanage servers using the below script. When I try to run "Invoke-SwisVerb" command, it gives me error as:

"Invoke-SwisVerb : Access to Orion.Nodes.Unmanage verb denied.".

Can someone help me on this why I received the error. I dont have SDK installed on the machine. Hope the install-module directly does the work.

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

#Find-Module -Name SwisPowerShell

#Install-Module -Name SwisPowerShell

Import-Module SwisPowerShell

$username = "********"

$password = "*******"

$secstr = New-Object -TypeName System.Security.SecureString

$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}

$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$secstr

$swis = Connect-Swis -Credential $cred -host $orionservername

$ORIONSERVERNAME = 'servername.domain.local'

$nodename = "***********"

$swis = Connect-Swis -Credential $cred -host $orionservername

$nodeid = Get-SwisData $swis "SELECT NodeID, Caption FROM Orion.Nodes WHERE SysName LIKE '$nodename%'"

$now =[DateTime]::UtcNow

$later=$now.AddDays(1)


Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.Nodes -Verb Unmanage -Arguments @("N:NodeID", $now, $later, "false")

 Do you have any idea on this.

Thanks in advance