Update-SCSMUserRole
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.
パラメーター
-PassThru
Specifies the output object that represents the updated user role. This output object can be passed to other cmdlets.
エイリアス |
なし |
必須? |
false |
位置は? |
named |
既定値 |
なし |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-UserRole<Role[]>
Specifies the UserRole object to which to add the user.
エイリアス |
なし |
必須? |
true |
位置は? |
1 |
既定値 |
なし |
パイプライン入力を許可する |
true (ByValue) |
ワイルドカード文字を許可する |
false |
-Confirm
コマンドレットを実行する前に、ユーザーに確認を求めます。
必須? |
false |
位置は? |
named |
既定値 |
false |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-WhatIf
コマンドレットを実行するとどのような結果になるかを表示します。コマンドレットは実行されません。
必須? |
false |
位置は? |
named |
既定値 |
false |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
<CommonParameters>
このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。
入力
入力型は、コマンドレットにパイプできるオブジェクトの型です。
Microsoft.EnterpriseManagement.ServiceManager.Sdk.UserRoles.Role
You can pipe a UserRole object to the UserRole parameter. For example, the object that is returned by the Get-SCSMUserRole cmdlet.
出力
出力型は、コマンドレットによって生成されるオブジェクトの型です。
None.
This cmdlet does not generate any output.
例
Example 1: Add a user to a user role
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
Example 2: Remove a user from a 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