Skip to content

New-ADGroupClone

SYNOPSIS

Clones an Active Directory group with optional members and memberships.

SYNTAX

New-ADGroupClone [-Identity] <String> [-NewName] <String> [-IncludeMembers] [-IncludeMemberOf] [-PassThru]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The `New-ADGroupClone` function creates a clone of an existing Active Directory group. It allows copying the group's members and the groups it is a member of. The new group will have the same attributes as the original group, except for the name, which must be specified.

EXAMPLES

EXAMPLE 1

New-ADGroupClone -Identity "Group1" -NewName "Group1_Clone"

Clones the group "Group1" and creates a new group named "Group1_Clone."

EXAMPLE 2

New-ADGroupClone -Identity "Group1" -NewName "Group1_Clone" -IncludeMembers

Clones the group "Group1", creates a new group named "Group1_Clone", and includes all members of the original group.

EXAMPLE 3

New-ADGroupClone -Identity "Group1" -NewName "Group1_Clone" -IncludeMemberOf

Clones the group "Group1", creates a new group named "Group1_Clone", and adds the cloned group to the same groups as the original group.

PARAMETERS

-Identity

The identity of the Active Directory group to clone (e.g., DistinguishedName, sAMAccountName).

Type: String
Parameter Sets: (All)
Aliases: DN, DistinguishedName, sAMAccountName

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-NewName

The name of the new cloned group.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-IncludeMembers

A switch parameter that, when specified, includes the members of the original group in the cloned group.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-IncludeMemberOf

A switch parameter that, when specified, adds the cloned group to the same groups as the original group.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

A switch parameter that, when specified, returns the newly created group object.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
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.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

CommonParameters

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

INPUTS

OUTPUTS

NOTES