Open-NetGPO

Open-NetGPO

Creates a cached copy of the Group Policy Object (GPO) to modify locally.

Sintaxis

Parameter Set: Open0
Open-NetGPO [-PolicyStore] <String> [-AsJob] [-CimSession <CimSession[]> ] [-DomainController <String> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Descripción detallada

The Open-NetGPO cmdlet caches the Group Policy Object (GPO) so that modifications can be made locally. The changes are batch returned to the policy store with the Save-NetGPO cmdlet.

Note: If the DomainController parameter value is not a writeable Domain Controller (DC), then the batch updates will not be applied. To help target a writeable DC, use the cmdlets in the Active Directory module using the Get-Command cmdlet with the Module parameter set to ActiveDirectory.

Note: An error will result for using this cmdlet when the user is not a domain administrator.

Parámetros

-AsJob

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-CimSession<CimSession[]>

Ejecuta el cmdlet en una sesión remota o en un equipo remoto. Escriba un nombre de equipo o un objeto de sesión, como la salida de un cmdlet New-CimSession o Get-CimSession. El valor predeterminado es la sesión actual en el equipo local.

Alias

Session

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-DomainController<String>

Specifies the DC used to target the GPO. If this cmdlet is used without specifying this parameter, then the DC can target a read-only DC (RODC), and lose the batch changes with Save-NetGPO. To help target a writeable DC, use the cmdlets in the Active Directory module using the Get-Command cmdlet with the Module parameter set to ActiveDirectory.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-PolicyStore<String>

Specifies the policy store from which to retrieve the rules to be stored.
A policy store is a container for firewall and IPsec policy.
Los valores aceptables para este parámetro son los siguientes:
-- PersistentStore: Sometimes called static rules, this store contains the persistent policy for the local computer. This policy is not from GPOs, and has been created manually or programmatically (during application installation) on the computer. Rules created in this store are attached to the ActiveStore and activated on the computer immediately.
-- ActiveStore: This store contains the currently active policy, which is the sum of all policy stores that apply to the computer. This is the resultant set of policy (RSOP) for the local computer (the sum of all GPOs that apply to the computer), and the local stores (the PersistentStore, the static Windows service hardening (WSH), and the configurable WSH).
-- -- GPOs are also policy stores. Computer GPOs can be specified as follows.
--- -- –PolicyStore hostname.
-- -- Active Directory GPOs can be specified as follows.
--- -- –PolicyStore domain.fqdn.com\GPO_Friendly_Namedomain.fqdn.comGPO_Friendly_Name.
--- -- Such as the following.
--- -- -- -PolicyStore localhost
--- -- -- -PolicyStore corp.contoso.com\FirewallPolicy
-- -- Active Directory GPOs can be created using the New-GPO cmdlet or the Group Policy Management Console.
-- RSOP: This read-only store contains the sum of all GPOs applied to the local computer.
-- SystemDefaults: This read-only store contains the default state of firewall rules that ship with Windows Server 2012.
-- StaticServiceStore: This read-only store contains all the service restrictions that ship with Windows Server 2012. Optional and product-dependent features are considered part of Windows Server 2012 for the purposes of WFAS.
-- ConfigurableServiceStore: This read-write store contains all the service restrictions that are added for third-party services. In addition, network isolation rules that are created for Windows Store application containers will appear in this policy store.
The default value is PersistentStore.
Note: The Set-NetIPsecRule cmdlet cannot be used to add an object to a policy store. An object can only be added to a policy store at creation time with this Copy-NetIPsecRule cmdlet or with the New-NetIPsecRule cmdlet.

Alias

ninguno

¿Requerido?

true

¿Posición?

1

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-ThrottleLimit<Int32>

Especifica el número máximo de operaciones simultáneas que se pueden establecer para ejecutar el cmdlet. Si se omite este parámetro o es especifica un valor de 0, Windows PowerShell ® calcula un límite óptimo para el cmdlet en función del número de cmdlets de CIM que se estén ejecutando en el equipo. El límite solo se aplica al cmdlet actual, no a la sesión ni al equipo.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

<CommonParameters>

Este cmdlet admite los siguientes parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Entradas

El tipo de entrada es el tipo de los objetos que se pueden canalizar al cmdlet.

  • None

Salidas

El tipo de resultado es el tipo de objetos que emite el cmdlet.

  • Microsoft.Management.Infrastructure.CimInstance#root\StandardCimv2\GPOSession

    El objeto Microsoft.Management.Infrastructure.CimInstance es una clase contenedora que muestra objetos de Instrumental de administración de Windows (WMI). La ruta de acceso después del signo de número (#) proporciona el espacio de nombres y el nombre de clase del objeto WMI subyacente.

Ejemplos

EXAMPLE 1

This example replaces one rule in a domain GPO with another using a cached copy of the GPO.

PS C:\> $gpoSession = Open-NetGPO –PolicyStore castle.contoso.com\Win8ClientFirewallPolicy
PS C:\> Remove-NetFirewallRule –Name BlockIMAccess –GPOSession $gpoSession
PS C:\> New-NetFirewallRule –Name LimitIMAccess –DisplayName "Contoso Messenger" –Program "%ProgramFiles(X86)%\Contoso Messenger\cmsg.exe" –Action Block –GPOSession $gpoSession
PS C:\> Save-NetGPO –GPOSession $gpoSession

EXAMPLE 2

This example shows targeting and opening a writeable DC. This ensures that the batch modifications are made when the GPO is closed.

PS C:\> $domain = "corp.contoso.com"
PS C:\> $gpo = "corp.contoso.com\FirewallPolicy"
PS C:\> $pdc = Get-ADDomainController -Discover -Service PrimaryDC -DomainName $domain
PS C:\> $session = Open-NetGPO -PolicyStore $gpo -DomainController $pdc.Hostname

Temas relacionados

New-NetFirewallRule

Remove-NetFirewallRule

Save-NetGPO

New-NetIPsecRule

Set-NetIPsecRule

Get-ADDomainController

New-GPO

Get-Command