New-PSGPO¶
Creates a GPO in the domain, empty or from a template.
The help of the command, as Get-Help New-PSGPO -Full gives it.
Syntax¶
New-PSGPO [-Name] <string> [[-Template] <Backup>] [[-StarterGpo] <string>] [[-Status] <string>] [[-Comment] <string>] [[-Directory] <GPOToolsDirectory>] [[-Server] <string>] [-WhatIf] [-Confirm] [<CommonParameters>]
Description¶
Like GPMC "New GPO": the GPO is created in the domain (on Windows with New-GPO of RSAT, on Linux with samba-tool and Kerberos), not linked. With -Template, it starts with the settings of a backup (Get-PSGPOBackup -Template: the backups with the template label of the configuration, Backup.TemplateLabel), whatever GPO or domain it comes from: its files, checked against their SHA-256, and their client-side extensions. With -StarterGpo, it starts with the Administrative Templates of a Starter GPO of the domain (Get-PSGPOStarterGpo), as New GPO > Source Starter GPO in GPMC. -Comment gives it a comment (GPO.cmt, the Comment of the Details tab of GPMC).
Parameters¶
-Name¶
Display name of the new GPO.
| Type | Required | Position | Default value | Accepts pipeline input |
|---|---|---|---|---|
String |
Yes | 1 | None | No |
-Template¶
Backup whose settings the GPO starts with.
| Type | Required | Position | Default value | Accepts pipeline input |
|---|---|---|---|---|
Object |
No | 2 | None | No |
-StarterGpo¶
Display name of the Starter GPO whose Administrative Templates the GPO starts with.
| Type | Required | Position | Default value | Accepts pipeline input |
|---|---|---|---|---|
String |
No | 3 | None | No |
-Status¶
GPO status: Enabled (default), ComputerOnly (user settings disabled) or UserOnly (computer settings disabled).
| Type | Required | Position | Default value | Accepts pipeline input |
|---|---|---|---|---|
String |
No | 4 | Enabled |
No |
-Comment¶
Comment of the GPO (several lines allowed).
| Type | Required | Position | Default value | Accepts pipeline input |
|---|---|---|---|---|
String |
No | 5 | None | No |
-Directory¶
Directory of the domain (Get-PSGPODirectory); the domain is read when not given.
| Type | Required | Position | Default value | Accepts pipeline input |
|---|---|---|---|---|
GPOToolsDirectory |
No | 6 | None | No |
-Server¶
Domain controller to read the domain from, without -Directory.
| Type | Required | Position | Default value | Accepts pipeline input |
|---|---|---|---|---|
String |
No | 7 | None | No |
-WhatIf¶
| Type | Required | Position | Default value | Accepts pipeline input |
|---|---|---|---|---|
SwitchParameter |
No | Named | None | No |
-Confirm¶
| Type | Required | Position | Default value | Accepts pipeline input |
|---|---|---|---|---|
SwitchParameter |
No | Named | None | No |
Examples¶
Example 1¶
New-PSGPO -Name 'C - Kiosks - Baseline' -Status ComputerOnly -Comment 'CHG-2041: kiosks of the halls'
Example 2¶
$Template = Get-PSGPOBackup -Path /srv/gpo-backups -Template -Name 'Template - Servers' | Select-Object -First 1
New-PSGPO -Name 'C - Servers - Lyon' -Template $Template
Example 3¶
Outputs¶
GPOToolsGpo