PowerShell Genie

Add-ADGroupMember

Use Add-ADGroupMember to add users, computers or other groups to an Active Directory group.

Command 1 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — Add-ADGroupMember

Syntax

1PS> Add-ADGroupMember [-Identity] <ADGroup> [-Members] <ADPrincipal[]> [-Server <String>] [-Credential <PSCredential>] [-PassThru] [-WhatIf] [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Add-ADGroupMember [-Identity] <ADGroup> [-Members] <ADPrincipal[]> [-Server <String>] [-Credential <PSCredential>] [-PassThru] [-WhatIf] [<CommonParameters>]
  1. Stage 1Add-ADGroupMember-Identity -Members -Server -Credential -PassThru -WhatIf

    Try it

    Windows PowerShell

    PowerShell example · browser support is limited.

    Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.

    Interactive simulation · fictional data

    Examples

    Add-ADGroupMember -Identity "Sales-Read"

    1PS> Add-ADGroupMember -Identity "Sales-Read" -Members jsmith, ajones
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Name     SamAccountName objectClass
    ----     -------------- -----------
    ajones   ajones         user
    jsmith   jsmith         user
    mchen    mchen          user

    Get-ADGroupMember -Identity "Sales-Read"

    1PS> Get-ADGroupMember -Identity "Sales-Read" -Recursive | Measure-Object # before and after
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Count    : 2
    Average  :
    Sum      :
    Maximum  :
    Minimum  :
    Property :

    Add-ADGroupMember -Identity "App-Users"

    1PS> Add-ADGroupMember -Identity "App-Users" -Members "Sales-Read"
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Name       SamAccountName objectClass
    ----       -------------- -----------
    Sales-Read Sales-Read     group
    jdoe       jdoe           user

    Parameters

    Parameter definitions:

    • -Identity
    • -Members
    • -Server
    • -Credential
    • -PassThru
    • -WhatIf

    Add-ADGroupMember on Microsoft Learn

    Practical use and troubleshooting

    Practical scenario: Use Add-ADGroupMember when you need to add users, computers or other groups to an Active Directory group. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.

    Common error and fix: Access denied requires rights to change the target group's membership. Resolve both the group and member before the change and re-query membership after the operation. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.

    See also: Remove-ADGroupMember. Add-ADGroupMember adds membership links; Remove-ADGroupMember removes them. Review direct membership separately from effective access obtained through nested groups. Read the linked command before substituting it; similar names do not imply identical inputs or output.

    Add-ADGroupMember reference on Microsoft Learn

    Recap

    Add-ADGroupMember Use Add-ADGroupMember to add users, computers or other groups to an Active Directory group.

    Next: Get-ADGroupMember
    Genie guideAdd-ADGroupMember

    Use Add-ADGroupMember to add users, computers or other groups to an Active Directory group. The console below is pre-loaded — run it, then change a value and run it again.