Grant-SCResource
Grant-SCResource
Grants a user or self-service user role access to a resource.
構文
Parameter Set: Default
Grant-SCResource -Resource <ClientObject> [-JobGroup <Guid]> ] [-JobVariable <String> ] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-UserName <String> ] [-UserRoleID <Guid[]> ] [-UserRoleName <String[]> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]
詳細説明
The Grant-SCResource cmdlet grants a user or self-service user role access to a resource.
Types of resources that can be shared using Grant-SCResource include the following:
-- Service templates
-- Virtual machine templates
-- Guest operating system profiles
-- SQL Server profiles
-- Hardware profiles
-- Application profiles
-- Services
-- Virtual machines
パラメーター
-JobGroup<Guid]>
Specifies an identifier for a series of commands that run as a set just before the final command that includes the same job group identifier runs.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-JobVariable<String>
Specifies that job progress is tracked and stored in the variable named by this parameter.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-OnBehalfOfUser<System.String>
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-OnBehalfOfUserRole<Microsoft.SystemCenter.VirtualMachineManager.UserRole>
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-PROTipID<Guid]>
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-Resource<ClientObject>
Specifies a resource object.
エイリアス |
none |
必須? |
true |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
True (ByValue) |
ワイルドカード文字を許可する |
false |
-RunAsynchronously
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-UserName<String>
Specifies a the name of a user. Enter a user name with the format Domain\User.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-UserRoleID<Guid[]>
Specifies the ID of a user role.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-UserRoleName<String[]>
Specifies the name of a user role. Types of user roles that are named include Delegated Administrator, Read-Only Administrator and Self-Service User.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-VMMServer<ServerConnection>
Specifies a VMM server object.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
<CommonParameters>
このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。
入力
入力型は、コマンドレットにパイプできるオブジェクトの型です。
出力
出力型は、コマンドレットによって生成されるオブジェクトの型です。
- Resource
例
Example 1: Share a resource with a specific user
The first command gets the template object named Template01, and then stores the object in the $Resource variable.
The second command shares the resource stored in $Resource with the user named Katarina. If the user is a member of multiple self-service user roles with receive permission, then a user role must be specified.
PS C:\> $Resource = Get-SCVMTemplate | where {$_.Name -eq "Template01"}
PS C:\> Grant-SCResource Resource $Resource -Username "Contoso\Katarina"
Example 2: Share a resource with a user who is a member of multiple user roles
The first command gets the template object named Template01, and then stores the object in the $Resource variable.
The second command shares the resource stored in $Resource with the user named Katarina, but only while that user is using the ContosoSelfServiceUsers or SelfServiceUserRole02 user roles.
PS C:\> $Resource = Get-SCVMTemplate | where {$_.Name -eq "Template01"}
PS C:\> Grant-SCResource -Resource $Resource -Username "Contoso\Katarina" -UserRoleName @("ContosoSelfServiceUsers", "SelfServiceUserRole02")
Example 3: Share a resource with all members of a user role
The first command gets the template object named VMTemplate01, and then stores the object in the $Resource variable.
The second command shares the resource stored in $Resource with the members of the user role named ContosoSelfServiceUsers.
PS C:\> $Resource = Get-SCVMTemplate | where {$_.Name -eq "VMTemplate01"}
PS C:\> Grant-SCResource -Resource $Resource -UserRoleName "ContosoSelfServiceUsers"
Example Example 4: Share a resource with all members of a user role by using the user role ID.
The first command gets the template object named VMTemplate01, and then stores the object in the $Resource variable.
The second command gets the user role object named ContosoSelfServiceUsers, and then stores the object in the $UserRole variable.
The last command shares the resource stored in $Resource with the members of user role ContosoSelfServiceUsers.
PS C:\> $Resource = Get-SCVMTemplate | where {$_.Name -eq "VMTemplate01"}
PS C:\> $UserRole = Get-SCUserRole -Name "ContosoSelfServiceUsers"
PS C:\> Grant-SCResource -Resource $Resource -UserRoleId $UserRole.Id