Set-SCOMUserRole
Updated: September 10, 2012
Applies To: System Center 2012 - Operations Manager, System Center 2012 SP1 - Operations Manager
Set-SCOMUserRole
Syntax
Parameter Set: FromAllClassScope Set-SCOMUserRole [-UserRole] <UserRole> -AllClass [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>] Parameter Set: FromAllGroupScope Set-SCOMUserRole [-UserRole] <UserRole> -AllGroup [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>] Parameter Set: FromAllTaskScope Set-SCOMUserRole [-UserRole] <UserRole> -AllTask [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>] Parameter Set: FromClassScope Set-SCOMUserRole [-UserRole] <UserRole> -ClassScope <ManagementPackClass[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>] Parameter Set: FromGroupcope Set-SCOMUserRole [-UserRole] <UserRole> -GroupScope <MonitoringObjectGroup[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>] Parameter Set: FromTaskScope Set-SCOMUserRole [-UserRole] <UserRole> -TaskScope <ManagementPackTask[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>] Parameter Set: FromUser Set-SCOMUserRole [-UserRole] <UserRole> -User <String[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Set-SCOMUserRole cmdlet configures an Operations Manager user role. You can update the user list or scope of the user role.
Parameters
-AllClass
Indicates that an Author user role is scoped to all classes.
|
Aliases |
none |
|
Required? |
true |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-AllGroup
Indicates that a user role is scoped to all groups.
|
Aliases |
none |
|
Required? |
true |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-AllTask
Indicates that an Author, Operator, or Advanced Operator user rule is scoped to all tasks.
|
Aliases |
none |
|
Required? |
true |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-ClassScope<ManagementPackClass[]>
Specifies the new collection of classes that an Author user role is scoped to. To remove all scoped classes, specify $null or an empty array @().
|
Aliases |
none |
|
Required? |
true |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-GroupScope<MonitoringObjectGroup[]>
Specifies the new collection of groups that a user role is scoped to. To remove all scoped groups, specify $null or an empty array @().
|
Aliases |
none |
|
Required? |
true |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-PassThru
Returns an object representing the user role. By default, this cmdlet does not generate any output.
|
Aliases |
none |
|
Required? |
false |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-TaskScope<ManagementPackTask[]>
Specifies the new collection of tasks that an Author, Operator, or Advanced Operator user role is scoped to. To remove all scoped tasks, specify $null or an empty array @().
|
Aliases |
none |
|
Required? |
true |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-User<String[]>
Specifies one or more user names to include in the user role. This list replaces any existing list of users. To clear all users from a user role, specify $null or an empty array @().
|
Aliases |
none |
|
Required? |
true |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-UserRole<UserRole>
Specifies a user role object.
|
Aliases |
none |
|
Required? |
true |
|
Position? |
1 |
|
Default Value |
none |
|
Accept Pipeline Input? |
true (ByValue) |
|
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before executing the command.
|
Required? |
false |
|
Position? |
named |
|
Default Value |
false |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-WhatIf
Describes what would happen if you executed the command without actually executing the command.
|
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.
Examples
-------------------------- EXAMPLE 1 --------------------------
The first command gets the user role object named Contoso Operators and stores the object in the $role variable.
The second command uses the pipeline operator to pass the user role stored in $role to Set-SCOMUserRole which grants the user role access to all tasks and returns the updated user role object. The command then passes the updated object to Set-SCOMUserRole which approves the role for all groups.
PS C:\> $role = Get-SCOMUserRole -Name 'Constoso Operators'PS C:\>$role | Set-SCOMUserRole -AllTask -PassThru | Set-SCOMUserRole -AllGroup
-------------------------- EXAMPLE 2 --------------------------
The first command gets the user role object named Contoso SQL Operators and stores the object in the $role variable.
The second command gets all task objects with SQL in their name and stores the objects in the $newTaskList variable
The last command uses the pipeline operator to pass the user role stored in $role to Set-SCOMUserRole which resets the collection of approved tasks to the list stored in $newTaskList
PS C:\> $role = Get-SCOMUserRole -Name 'Constoso SQL Operators'PS C:\>$newTaskList = Get-SCOMTask -Name '*SQL*'PS C:\>$role | Set-SCOMUserRole -TaskScope $newTaskList
-------------------------- EXAMPLE 3 --------------------------
The first command gets the user role object named Contoso Read-Only Operators and stores the object in the $role variable.
The second command uses the pipeline operator to pass the role stored in $role to Set-SCOMUserRole which adds the user contoso\Cesar to the existing list of users for the role.
PS C:\> $role = Get-SCOMUserRole -Name 'Contoso Read-Only Operators'PS C:\>$role | Set-SCOMUserRole -User ($role.Users + 'contoso\Cesar')
