Share via


Remove-SCSMUserRole

Remove-SCSMUserRole

Removes a user role from Service Manager.

Syntax

Parameter Set: Default
Remove-SCSMUserRole [-UserRole] <Role[]> [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed 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.

Parameters

-UserRole<Role[]>

Specifies the UserRole object from which to remove the user.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

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.

  • 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

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

  • None.

    This cmdlet does not generate any output.

Examples

Example 1: Remove a user role

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.

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

Get-SCSMUserRole

New-SCSMUserRole

Update-SCSMUserRole