ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Add Active Directory User to Group using PowerShell

    IT Discussion
    sam windows administration windows windows server active directory powershell add-adgroupmember get-adgroupmember comandlet
    2
    2
    1.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      When we work strictly from Windows Server Core installations we need to be able to do everything from the command line, even user management. Let's add a user that already exists into a group that already exists in Active Directory using only PowerShell.

      To do this we have the handy Add-ADGroupMember PowerShell commandlet. This is very easy to use in its basic form, all we need is the name of the group and of the user that we want to add. In this case, I want to add user jane to the group "Domain Admins".

      Add-ADGroupMember "Domain Admins" jane
      

      That's it, jane is added automatically. This process, like most, is silent on success. To verify that all is as we want it to be, we can use the Get-ADGroupMember command to look up the members of a group.

      Get-ADGroupMember "Domain Admins"
      
      FrostyPhoenixF 1 Reply Last reply Reply Quote 6
      • FrostyPhoenixF
        FrostyPhoenix @scottalanmiller
        last edited by

        @scottalanmiller said in Add Active Directory User to Group using PowerShell:

        When we work strictly from Windows Server Core installations we need to be able to do everything from the command line, even user management. Let's add a user that already exists into a group that already exists in Active Directory using only PowerShell.

        To do this we have the handy Add-ADGroupMember PowerShell commandlet. This is very easy to use in its basic form, all we need is the name of the group and of the user that we want to add. In this case, I want to add user jane to the group "Domain Admins".

        Add-ADGroupMember "Domain Admins" jane
        

        That's it, jane is added automatically. This process, like most, is silent on success. To verify that all is as we want it to be, we can use the Get-ADGroupMember command to look up the members of a group.

        Get-ADGroupMember "Domain Admins"
        

        Can also do
        Add-ADGroupMember -identity "Domain Admins" -members "jane" -WhatIf
        to see if it gets added before actually running the command.

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post