Export (0) Print
Expand All

New-GPO

Windows Server 2012 R2 and Windows 8.1

Updated: March 26, 2014

Applies To: Windows 8.1, Windows PowerShell 4.0, Windows Server 2012 R2

New-GPO

Creates a new GPO.

Syntax

Parameter Set: New
New-GPO [-Name] <String> [-Comment <String> ] [-Domain <String> ] [-Server <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: NewStarterGUID
New-GPO [-Name] <String> -StarterGpoGuid <Guid> [-Comment <String> ] [-Domain <String> ] [-Server <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: NewStarterName
New-GPO [-Name] <String> -StarterGpoName <String> [-Comment <String> ] [-Domain <String> ] [-Server <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]




Detailed Description

The New-GPO cmdlet creates a new GPO with a specified name. By default, the newly created GPO is not linked to a site, domain, or organizational unit (OU).

You can use this cmdlet to create a GPO that is based on a starter GPO by specifying the GUID or the display name of the Starter GPO, or by piping a StarterGpo object into the cmdlet.

The cmdlet returns a GPO object, which represents the newly created GPO, that you can pipe to other Group Policy cmdlets.

Parameters

-Comment<String>

Includes a comment for the new GPO. The comment string must be enclosed in double- or single-quotation marks and can contain 2,047 characters.

Use the comment to document the GPO and its implementation in your environment. Or, if you insert keywords in the comment, you can use the keyword filter to find GPOs that have matching keywords.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Domain<String>

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

For the New-GPO cmdlet:

-- The new GPO is created in this domain.

-- If a Starter GPO is specified, it must exist in this domain.

If you do not specify the Domain parameter, then the domain of the user 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 running the current session (or the computer for a startup or shutdown script), then a trust must exist between that domain and the domain of the user (or computer).

You can also refer to Domain by its built-in alias, "domainname". For more information, see about_Aliases.


Aliases

none

Required?

false

Position?

named

Default Value

Current domain

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Name<String>

Assigns a display name to the new GPO.

If another GPO with the same display name exists in the domain an error occurs.

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


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

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.SalesDomain.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.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-StarterGpoGuid<Guid>

Specifies a Starter GPO by its globally unique identifier (GUID). The GUID uniquely identifies the Starter GPO. If a Starter GPO is specified, the GPO is created with its settings.

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


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-StarterGpoName<String>

Specifies a Starter GPO by its display name. The name can contain 255 characters. If the name includes blank characters, enclose the name in double-quotation marks or single-quotation marks. If a Starter GPO is specified, the GPO is created with its settings.

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

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


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.GroupPolicy.StarterGpo

    A Starter GPO that has predefined settings.


Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.GroupPolicy.Gpo

    New-GPO returns the GPO that was created.


Notes

  • Only domain administrators, enterprise administrators, and members of the Group Policy creator owners group can create GPOs. These users must run Windows PowerShell in an elevated state.

    You can use the Domain 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.

Examples

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

Description

-----------

This command creates a GPO in the domain of the user. The GPO is created with the specified comment.


C:\PS>New-GPO -Name TestGPO -comment "This is a test GPO." 
DisplayName      : TestGPO 
DomainName : contoso.com
Owner : CONTOSO\Domain Admins
Id : b8c1f2c2-fbd3-4a1f-94e1-3e156a65a29a
GpoStatus : AllSettingsEnabled
Description : This is a test GPO.
CreationTime : 3/2/2009 3:37:23 AM
ModificationTime : 3/2/2009 3:37:22 AM
UserVersion : AD Version: 0, SysVol Version: 0
ComputerVersion : AD Version: 0, SysVol Version: 0
WmiFilter :

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

Description

-----------

This command creates a GPO in the domain of the user. The GPO is pre-populated with the settings of the Starter GPO.


C:\PS>New-GPO -Name FromStarterGPO -StarterGPOName "Windows Vista EC Computer Starter GPO"

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

Description

-----------

This command creates a new GPO ("TestGPO"), links it to the "Marketing" OU in the contoso.com domain, and grants the "Marketing Admins" security group permissions to edit the GPO.

A GPO object is returned by the command, so you could continue to configure the new GPO by piping the output to other cmdlets. For example, you could set Registry preference items or registry-based policy settings by piping the output to Set-GPPrefRegistryValue or to Set-GPRegistryValue.


C:\PS>new-gpo -name TestGPO | new-gplink -target "ou=marketing,dc=contoso,dc=com" | set-gppermissions -permissionlevel gpoedit -targetname "Marketing Admins" -targettype group 
DisplayName      : TestGPO 
DomainName : contoso.com
Owner : CONTOSO\Domain Admins
Id : b8c1f2c2-fbd3-4a1f-94e1-3e156a65a29a
GpoStatus : AllSettingsEnabled
Description :
CreationTime : 3/2/2009 3:37:23 AM
ModificationTime : 3/2/2009 3:37:22 AM
UserVersion : AD Version: 0, SysVol Version: 0
ComputerVersion : AD Version: 0, SysVol Version: 0
WmiFilter :

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft