Deleting an Orion Agent and its Node using Powershell SDK instead of GUI

I want to replicate the behavior in the GUI that occurs if I go to:

https://myOrionServer/Orion/AgentManagement/Admin/ManageAgents.aspx

Select an Agent, and click Delete. This not only removes the Agent registration, it also deletes the Node and cleans up everything associated with it.

I THINK the correct way to do that with Powershell is:

invoke-swisverb $swis Orion.AgentManagement.Agent delete @($agentid)

Where $swis is the SwisConnection, Orion.AgentManagement.Agent is the Entity, delete is the Verb, and $agentid is the integer in the AgentId column in the Orion.AgentManagement.Agent table.

Am I correct in my syntax? Will this accomplish the same thing that using the GUI does when I select an Agent and click Delete? If not, what else would I need to do?

Parents
  • I like this and I am trying to implement this in my environment. How are you obtaining the the Agent ID to delete? I don't see a specific variable to use. Or perhaps there is a custom variable I can create using SWQL? Any help would be greatly appreciated!

Reply
  • I like this and I am trying to implement this in my environment. How are you obtaining the the Agent ID to delete? I don't see a specific variable to use. Or perhaps there is a custom variable I can create using SWQL? Any help would be greatly appreciated!

Children
No Data