Remove-CMSecurityRole
Remove-CMSecurityRole
Removes custom security roles from Configuration Manager.
Syntax
Parameter Set: SearchByIdMandatory
Remove-CMSecurityRole -Id <String[]> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: SearchByNameMandatory
Remove-CMSecurityRole -Name <String[]> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: SearchByValueMandatory
Remove-CMSecurityRole -InputObject <IResultObject> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Remove-CMSecurityRole cmdlet removes custom security roles from Microsoft System Center 2012 SP1 Configuration Manager. Specify the name or ID of a security role you want to remove or use the Get-CMSecurityRole cmdlet to obtain one.
Configuration Manager uses security roles, along with security scopes and collections, to define an administrative scope for each administrative user. Configuration Manager provides several built-in security roles. To create a custom security role, copy an existing security role, and then modifying the copy. You can copy a security role by using the Copy-CMSecurityRole cmdlet.
You can use the Remove-CMSecurityRole cmdlet to remove old, unneeded custom security roles. You cannot remove built-in security roles. Every administrative user must have at least one security role. Before you remove a security role, make sure every user has a role in addition to the one you remove.
Parameters
-Force
Performs the action without a confirmation message.
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 of security roles.
Aliases |
RoleId |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-InputObject<IResultObject>
Specifies a security role object. To obtain a security role object, use the Get-CMSecurityRole cmdlet.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Name<String[]>
Specifies an array of names of security roles.
Aliases |
RoleName |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
true |
-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 security role by using a name
This command removes a security role named MainSecurityRole from Configuration Manager. The command uses the Force parameter, so it does not prompt you for confirmation.
PS C:\> Remove-CMSecurityRole -Name "MainSecurityRole" -Force
Example 2: Remove security roles by using a variable
The first command uses the Get-CMSecurityRole cmdlet to get each security role that has a name that ends in Role. It stores them in the $Roles variable.
The second command removes each security role stored in the $Roles variable.
PS C:\> $Roles = Get-CMSecurityRole -Name *Role
PS C:\> Remove-CMSecurityRole -SecurityRole $Roles