Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Save-NetGPO

Save-NetGPO

netgpo.cmdletdefinition.cdxml

Synopsis

Applies the modified cached local Group Policy Object (GPO) to the actual GPO.

Syntax

Save-NetGPO [-GPOSession] [-AsJob] [-CimSession] [-ThrottleLimit] [<CommonParameters>]

Detailed Description

The Save-NetGPO cmdlet saves the changes made to the local cached group policy object. The cached Group Policy Object (GPO) copy is created with the Open-NetGPO cmdlet.

Individual operations on group policy objects require a round-trip to load the policy store. When the policy store is a GPO on a busy domain controller, an administrator will want to open the GPO, do the work on it, and then save it back, with an in-memory copy.

Modifications are performed through the use of the GPOSession parameter.

Note: This cmdlet does not batch individual changes, it loads and saves the entire GPO at once. If any other changes were made by another administrator, or in a different Windows PowerShell® session, saving the GPO would overwrite those changes.

Parameters

-AsJob <SwitchParameter>

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete. The cmdlet immediately returns an object that represents the job and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the *-Job cmdlets. To get the job results, use the Receive-Job cmdlet. For more information about Windows PowerShell® background jobs, see about_Jobs.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-CimSession <CimSession[]>

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Aliases

Session

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-GPOSession <String>

Specifies the GPO session to be saved. This parameter is used in the same way as the PolicyStore parameter. When modifying GPOs in Windows PowerShell®, each change to a GPO requires the entire GPO to be loaded, modified, and saved back. On a busy Domain Controller (DC), this can be a slow and resource-heavy operation. A GPO session loads a domain GPO onto the local computer and makes all changes in a batch, before saving it back. This reduces the load on the DC and speeds up the Windows PowerShell cmdlets. To load a GPO Session, use the Open-NetGPO cmdlet. To save a GPO Session, use this cmdlet.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ThrottleLimit <Int32>

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

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

Return Type

None

Notes

None

Examples

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

Online Version
New-NetFirewallRule
Open-NetGPO
Remove-NetFirewallRule