Add-ControlledGpo

Adds GPOs to an AGPM archive.

Syntax

Add-ControlledGpo
   [-PassThru]
   [-Comment <String>]
   [[-Gpos] <Gpo[]>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Add-ControlledGpo cmdlet adds uncontrolled Group Policy Objects (GPOs) to an Advanced Group Policy Management (AGPM) archive. That GPO becomes a controlled GPO.

Examples

Example 1: Add a GPO by using the pipeline operator

PS C:\>Get-Gpo -Name "TSQA Group policies" | Add-ControlledGpo -PassThru
Name            : TSQA Group policies
ID              : {5507363B-6AEB-4EFF-89FD-1567CD1E14E5}
CheckoutID      : 
BackupID        : {185339E4-54C1-441F-A53B-4510E93DA424}
State           : CHECKED_IN
ComputerVersion : 2
UserVersion     : 2
Deployed        : 
Changed         : 11/25/2014 9:37:18 AM
ChangedBy       : CONTOSO\Admin07
WmiFilterName   : 
Comment         :

This command uses the Get-Gpo cmdlet to get the uncontrolled GPO named TSQA Group policies. For more information, type Get-Help Get-Gpo. The command passes that GPO to the current cmdlet. This cmdlet adds that GPO to the AGPM archive.

Example 2: Add a GPO by using a variable

PS C:\>$GpoObject = Get-Gpo -Name "TSQA Group policies"
PS C:\> Add-ControlledGpo -Gpos $GpoObject -PassThru
Name            : TSQA Group policies
ID              : {5507363B-6AEB-4EFF-89FD-1567CD1E14E5}
CheckoutID      : 
BackupID        : {70D90CA2-E396-4549-A2C9-18EED518F6F1}
State           : CHECKED_IN
ComputerVersion : 2
UserVersion     : 2
Deployed        : 
Changed         : 11/25/2014 9:54:12 AM
ChangedBy       : CONTOSO\Admin07
WmiFilterName   : 
Comment         :

The first command uses Get-Gpo to get the uncontrolled GPO named TSQA Group policies, and then stores that object in the $GpoObject variable.

The second command adds the object stored in $GpoObject to the AGPM archive.

Parameters

-Comment

Specifies a comment for the change that this cmdlet makes.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Gpos

Specifies an array of GPOs to add to the AGPM archive. To obtain GPOs, use the Get-Gpo cmdlet. For more information, type Get-Help Get-Gpo.

Type:Gpo[]
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PassThru

Indicates that this cmdlet returns the controlled GPOs on which the cmdlet operates. If you do not specify this parameter, this cmdlet returns no results.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.GroupPolicy.Gpo

This cmdlet accepts GPO objects.

Outputs

Microsoft.Agpm.ControlledGpo

This cmdlet returns controlled GPO objects, if you specify the PassThru parameter.