Come and Check our BETA Alpha version of Powershellcenter.net
Send me your comment to Powershell@powershellcenter.com

Synopsis

Uninstalls agents from agent-managed computers.

Syntax

Uninstall-SCOMAgent [-ActionAccount <PSCredential>] [-PassThru [<SwitchParameter>]] -Agent <AgentManagedComputer[]> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]

Detailed Description

The Uninstall-SCOMAgent cmdlet uninstalls agents from agent-managed computers.

Parameters

-ActionAccount [<PSCredential>]

Specifies the credentials under which the agent uninstall task will run. If this parameter is omitted or has a null value, the default action account of the management server managing the agent is used.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-Agent [<AgentManagedComputer[]>]

Specifies one or more agent objects to uninstall. Enter a variable that represents the agents, or type a command that gets the agents.

For information about how to get agents, type Get-Help Get-SCOMAgent.

Required?   true
Position?   named
Default value?  
Accept pipeline input?   true (ByValue)
Accept wildcard characters?   false

-PassThru [<SwitchParameter>]

Returns an object representing the agent. By default, this cmdlet does not generate any output.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-Confirm [<SwitchParameter>]

Prompts you for confirmation before executing the command.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-WhatIf [<SwitchParameter>]

Describes what would happen if you executed the command without actually executing the command.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

Input Type

Microsoft.EnterpriseManagement.Administration.AgentManagedComputer

Return Type

Microsoft.EnterpriseManagement.Administration.AgentTaskResult

Notes

Examples

EXAMPLE 1

PS> PS C:\>Get-SCOMAgent Server01.Contoso.com | Uninstall-SCOMAgent

Description

-----------

This command gets the agent "Server01.Contoso.com" and then uninstalls it.

EXAMPLE 2

PS> PS C:\>$Agent = Get-SCOMAgent Server01.Contoso.com PS C:\>Uninstall-SCOMAgent -Agent $Agent

Description

-----------

The first command gets the agent-managed computer named "Server01.Contoso.com" and stores it in the $Agent variable.

The second command uninstalls the agent stored in the $Agent variable.

EXAMPLE 3

PS> PS C:\>$Agent = Get-SCOMAgent Server01.Contoso.com PS C:\>Uninstall-SCOMAgent -Agent $Agent -ActionAccount (Get-Credential)

Description

-----------

The first command gets the agent named "Server01.Contoso.com" and stores it in the $Agent variable.

The second command uninstalls the agent stored in the $Agent variable using the credentials the user is prompted for.