Remove-CMUser

Remove-CMUser

Removes Configuration Manager user accounts.

Syntax

Parameter Set: SearchByIdMandatory
Remove-CMUser -Id <String[]> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SearchByNameMandatory
Remove-CMUser -Name <String> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SearchByValueMandatory
Remove-CMUser -InputObject <IResultObject> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Remove-CMUser cmdlet removes Microsoft System Center 2012 SP1 Configuration Manager user accounts. You can specify user accounts to remove by ID or by name, or you can use the Get-CMUser cmdlet to obtain user accounts to remove.

Parameters

-Force

Forces the command to run without asking for user confirmation.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Id<String[]>

Specifies an array of IDs for Configuration Manager user accounts.

Aliases

ResourceId

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-InputObject<IResultObject>

Specifies a Configuration Manager user account object. To obtain a Configuration Manager user account object, use the Get-CMUser cmdlet.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of a Configuration Manager user account.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Remove a user account by using an ID

This command removes the user account that has the ID 2063597584.

PS C:\> Remove-CMUser -Id "2063597584"

Example 2: Remove a user account by name

This command removes a user account that has the specified name.

PS C:\> Remove-CMUser -Name "FAREAST\001D$ (001D$)"

Example 3: Remove user accounts by using a variable

This example removes user accounts that are part of the collection that has the ID SMS00004. The first command uses the Get-CMUser cmdlet to get the user accounts that belong to the collection with the specified ID, and stores those user accounts in the $CMUsers variable.

The second command removes the user accounts stored in the $CMUsers variable.

PS C:\> $CMUsers = Get-CMUser -CollectionID "SMS00004"
PS C:\> Remove-CMUser -InputObject $CMUsers

Get-CMUser