Update-SCSMUserRole
Sets the UserRole property for a Service Manager user.
Parameter Set: Default
Update-SCSMUserRole [-UserRole] <Role[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]
The Update-SCSMUserRole cmdlet sets the UserRole property for a Service Manager user.
Indicates that this cmdlet returns the user role that it updates. You can pass this object to other cmdlets.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Specifies the UserRole object to which to add the user.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
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 |
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).
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 UserRole object to the UserRole parameter. To obtain a user role, use the Get-SCSMUserRole cmdlet.
The output type is the type of the objects that the cmdlet emits.
None.
This cmdlet does not generate any output.
The first command gets the user role named IncidentResolvers by using Get-SCSMUserRole, and then stores it in the $Role variable.
The second command gets a user by using the Get-SCSMUser cmdlet, and then stores that object in the $User variable.
The third command appends $User to the User property of $Role.
The final command updates the role to match the current value of $Role.
PS C:\>$Role = Get-SCSMUserRole -Name "IncidentResolvers"
PS C:\> $User = Get-SCSMUser -UserName "PattiFuller"
PS C:\> $Role.User += $User
PS C:\> Update-SCSMUserRole -Role $Role
This example removes a user from a user role. The first command displays administrators.
PS C:\> Get-SCSMUserRole -Name "Administrators"
The second command assigns the user role previously displayed to the $Role variable.
PS C:\>$Role = Get-SCSMUserRole -Name "Administrators"
The third command assigns the first user role to the User property of $Role. This command that property, removing all except the specified user.
PS C:\>$Role.User = $Role.Users[0]
The final command updates the role to match the current value of $Role.
PS C:\> Update-SCSMUserRole -Role $Role