System Center Operations Manager

Broadcasting live from Redmond, Washington

How to Delete an Operations Manager 2007 Managed Object from a Management Group using PowerShell

We have had some customers ask us if there is a way to remove an agent managed computer using PowerShell from OpsMgr 2007 after the agent managed computer has been turned off. The scenario is that the machine that has an agent installed on it gets de-commissioned for some reason and now the user would like to get rid of all the traces left by that particular agent machine using PowerShell. The attached PowerShell script should take care of this for you. Note: This script is not officially supported by the product team and used only when needed.

 

You need to specify the FQDN of the machine name after you run the script \DeleteAgent.ps1  satyamachine.vel.net

 

 

Why am I am not able to execute custom scripts in PowerShell?

On some PowerShell installs you will not be able to run this script because PowerShell is probably running on “Restricted” mode which means that the scripts need to be signed. You can bypass this by doing the following.

 

To change the script execution mode from the default RemoteSigned script execution mode, use the Set-Unrestricted cmdlet in the OpsMgr 2007 Command Shell. The OpsMgr 2007 Command Shell recognizes the change to the policy immediately.

Users that want to set a consistent script execution mode for all computers that are running the OpsMgr 2007 Command Shell should apply the script execution mode setting by using an Active Directory group policy. You configure the Active Directory group policy to set the ExecutionPolicy value located under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell registry key to the desired script execution mode.

Satya Vel | Program Manager | System Center |

 

Published Wednesday, September 03, 2008 7:30 PM by DeploymentMan
Attachment(s): DeleteAgent.zip

Comments

 

Turkey said:

great an article, I'm very thank you, I think really usefull, I'm following  comments, thanks

September 10, 2008 1:30 PM
 

bday said:

What if we used the uninstall option for the Agent from the console successful, then formatted the machine. What is the best way to purge it from Operations Manager at that point since it now shows up as grey with an overall healthy checkmark and no checkmark at all in the agent area as it was no longer agent managed? Thanks!

September 15, 2008 1:17 PM
 

opsmgr said:

I am a rookie admin with power shell. When you said "you need to specify the FQDN of the machine name after you run the script \DeleteAgent.ps1 machine FQDN" how do i run this? I have tried to run this script directly or by copying into the powershell script. Thanks.

September 23, 2008 3:36 PM
 

fluoxet said:

[url=http://fluoxetine.wikispaces.com/]fluoxetine 30

[/url]

September 29, 2008 10:58 PM
 

B-Serge said:

Same question as bday. We successfully removed the agent via the console Uninstall command before decommissioning the server.

However the machine(s) remain in the Monitoring pane/Computer State view as grey 'lingering' objects with no option to delete them.

September 30, 2008 4:44 PM
 

Gopemaree said:

Hi all!

Nice site!

G'night

October 1, 2008 9:45 AM
New Comments to this post are disabled

This Blog

Syndication


© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker