Set-GPPermission

Set-GPPermission

Grants a level of permissions to a security principal for one GPO or all the GPOs in a domain.

エイリアス

以下の略語は、このコマンドレット用のエイリアスです。

  • Set-GPPermissions

構文

Parameter Set: PermissionOne(GUID)
Set-GPPermission -Guid <Guid> -PermissionLevel <GPPermissionType> -TargetName <String> -TargetType <PermissionTrusteeType> [-DomainName <String> ] [-Replace] [-Server <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: PermissionAll
Set-GPPermission -All -PermissionLevel <GPPermissionType> -TargetName <String> -TargetType <PermissionTrusteeType> [-DomainName <String> ] [-Replace] [-Server <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: PermissionOne(Name)
Set-GPPermission [-Name] <String> -PermissionLevel <GPPermissionType> -TargetName <String> -TargetType <PermissionTrusteeType> [-DomainName <String> ] [-Replace] [-Server <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]




詳細説明

Grants a level of permissions to a security principal (user, security group, or computer) for one GPO or all the GPOs in a domain. You use the TargetName and TargetType parameters to specify a user, security group, or computer for which to set the permission level. You can use the Name or the Guid parameter to set the permission level for the security principal on a single GPO, or you can use the All parameter to set the permission level for the security principal on all GPOs in the domain.

By default, if the security principal already has a higher permission level than the specified permission level, the change is not applied. You can specify the Replace parameter, to remove the existing permission level from the GPO before the new permission level is set. This ensures that the existing permission level is replaced by the new permission level.

パラメーター

-All

Specifies that the permission level is set for the specified security principal for all GPOs in the domain.


エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-DomainName<String>

Specifies the domain for this cmdlet. You must specify the fully qualified domain name (FQDN) of the domain (for example: sales.contoso.com).

For the Set-GPPermission cmdlet, the GPO for which to get the permission level must exist in this domain.

If you do not specify the DomainName parameter, the domain of the user that is running the current session is used. (If the cmdlet is being run from a computer startup or shutdown script, the domain of the computer is used.) For more information, see the Notes section in the full Help.

If you specify a domain that is different from the domain of the user that is running the current session (or, for a startup or shutdown script, the computer), a trust must exist between that domain and the domain of the user (or the computer).

You can also refer to the Server parameter by its built-in alias, "domain". For more information, see about_Aliases.


エイリアス

domain

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Guid<Guid>

Specifies the GPO for which to set the permission level by its globally unique identifier (GUID). The GUID uniquely identifies the GPO.

You can also refer to the Guid parameter by its built-in alias, "id". For more information, see about_Aliases.


エイリアス

id

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

true (ByPropertyName)

ワイルドカード文字を許可する

false

-Name<String>

Specifies the GPO for which to set the permission level by its display name.

The display name is not guaranteed to be unique in the domain. If another GPO with the same display name exists in the domain, an error occurs. You can use the Guid parameter to uniquely identify a GPO.

You can also refer to the Name parameter by its built-in alias, "displayname". For more information, see about_Aliases.


エイリアス

displayname

必須?

true

位置は?

1

既定値

なし

パイプライン入力を許可する

true (ByValue, ByPropertyName)

ワイルドカード文字を許可する

false

-PermissionLevel<GPPermissionType>

Specifies the permission level to set for the security principal. The valid permission levels are: GpoRead, GpoApply, GpoEdit, GpoEditDeleteModifySecurity or None.


エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Replace

Specifies that the existing permission level for the group or user is removed before the new permission level is set. If a security principal is already granted a permission level that is higher than the specified permission level and you do not use the Replace parameter, no change is made.


エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Server<String>

Specifies the name of the domain controller that this cmdlet contacts to complete the operation. You can specify either the fully qualified domain name (FQDN) or the host name. For example:

FQDN: DomainController1.sales.contoso.com

Host Name: DomainController1

If you do not specify the name by using the Server parameter, the PDC emulator is contacted.

You can also refer to the Server parameter by its built-in alias, "dc". For more information, see about_Aliases.


エイリアス

dc

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-TargetName<String>

The name of the security principal for which to set the permission level. You can specify a user, a security group, or a computer. You can use either the domain-qualified name of the security principal (domain\account) or just its name.

For example, in the contoso.com domain, to specify:

-- The user "someuser", use "contoso\someuser" or "someuser".

-- The Domain Admins security group, use "contoso\Domain Admins" or "Domain Admins".

-- The computer "computer-01", use "contoso\computer-01" or "computer-01".


エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-TargetType<PermissionTrusteeType>

The type of security principal for which to set the permission level. You must specify User, Group, or Computer.

The following values are permitted for this object type.

-- Computer

-- User

-- Group


エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Confirm

コマンドレットを実行する前に、ユーザーに確認を求めます。


必須?

false

位置は?

named

既定値

false

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-WhatIf

コマンドレットを実行するとどのような結果になるかを表示します。コマンドレットは実行されません。


必須?

false

位置は?

named

既定値

false

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

<CommonParameters>

このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216)。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

  • Microsoft.GroupPolicy.Gpo

    An object that represents a GPO. Collections that contain GPOs from different domains are not supported.


出力

出力型は、コマンドレットによって生成されるオブジェクトの型です。

  • Microsoft.GroupPolicy.Gpo

    Set-GPPermission returns an object that represents the GPO for which the permission level was set.


  • You can use the DomainName parameter to explicitly specify the domain for this cmdlet.

    If you do not explicitly specify the domain, the cmdlet uses a default domain. The default domain is the domain that is used to access network resources by the security context under which the current session is running. This domain is typically the domain of the user that is running the session. For example, the domain of the user who started the session by opening Windows PowerShell from the Program Files menu, or the domain of a user that is specified in a runas command. However, computer startup and shutdown scripts run under the context of the LocalSystem account. The LocalSystem account is a built-in local account, and it accesses network resources under the context of the computer account. Therefore, when this cmdlet is run from a startup or shutdown script, the default domain is the domain to which the computer is joined.

-------------------------- EXAMPLE 1 --------------------------

Description

-----------

This command sets the permission level for the "Domain Users" security group to GpoRead for the GPO named "TestGpo". Because the Replace parameter is not specified, if the group already has a permission level higher than GpoRead, such as GpoEdit, no action is taken.


PS C:\> Set-GPPermission -Name TestGpo -TargetName "Domain Users" -TargetType Group -PermissionLevel GpoRead

-------------------------- EXAMPLE 2 --------------------------

Description

-----------

This command sets the permission level for the "Marketing Admins" security group to GpoEdit on all GPOs in the domain. This includes GPOs that are not linked to any site, domain, or OU. Because the Replace parameter is specified, the new permission level overwrites the existing permissions set for the group.


PS C:\> Set-GPPermission -All -TargetName "Marketing Admins" -TargetType Group -PermissionLevel GpoEdit -Replace

-------------------------- EXAMPLE 3 --------------------------

Description

-----------

This command replaces the current permission level of the "Marketing Admins" security group with GpoApply for all GPOs on which the group has permissions. The command returns each GPO for which the new permission level is set.

First, Get-GPO is used to retrieve all the GPOs in the domain (Get-GPO -All). Then, the collection is piped into the foreach-object command. As each GPO is evaluated, it is piped into Get-GPPermissions. If a permission level for the "Marketing Admins" group is returned, the GPO is piped into Set-gppermission to set the permission level for the group. The Replace parameter is specified to make sure that the previous permission level is overwritten.

Note: The ErrorAction parameter is set to SilentlyContinue for Get-GPPermissions. This is because a non-terminating error occurs if the specified security principal does not have permissions on the GPO. Specifying the ErrorAction as SilentlyContinue prevents the error messages from being printed for GPOS on which the security principal does not have permissions. For more information about the ErrorAction parameter, see about_CommonParameters.


PS C:\> Get-GPO -All | foreach-object { if($_ | Get-GPPermission -TargetName "Marketing Admins" -TargetType Group -ErrorAction SilentlyContinue) {$_ | Set-GPPermission -Replace -PermissionLevel GpoApply -TargetName "Marketing Admins" -TargetType group }}

関連トピック

コミュニティの追加

追加
表示: