Share via


Remove-SCSMUserRole

Removes a user role from Service Manager.

Syntax

Default (Default)

Remove-SCSMUserRole
    [-UserRole] <Role[]>
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Remove-SCSMUserRole cmdlet removes a user role from Service Manager. Some user roles are designated as system user roles, and cannot be removed. You can run the following command to display the issystem attribute of all user role objects.

Get-SCSMUserRole | Format-Table -Property DisplayName,{$_.userrole.issystem} -AutoSize

If the user role cannot be removed, this cmdlet returns a non-terminating error.

Examples

Example 1: Remove a user role

PS C:\>Get-SCSMUserRole -Name "CustomUser" | Remove-SCSMUserRole

This command gets the user role named CustomUser by using the Get-SCSMUserRole cmdlet. The command passes that object to the current cmdlet by using the pipeline operator. That cmdlet deletes that user role.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UserRole

Specifies the UserRole object from which to remove the user.

Parameter properties

Type:

Microsoft.EnterpriseManagement.ServiceManager.Sdk.UserRoles.Role[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.EnterpriseManagement.ServiceManager.Sdk.UserRoles.Role

You can pipe a user role to the UserRole parameter. For example, an object such as that returned by the Get-SCSMUserRole cmdlet.

Outputs

None.

This cmdlet does not generate any output.