Remove-SCSMUserRole

Removes a user role from Service Manager.

Syntax

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.

Required Parameters

-UserRole

Specifies the UserRole object from which to remove the user.

Type:Role[]
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
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.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

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.