Powershell

How to Use the Remove-ADGroupMember (ActiveDirectory)

An Active Directory group can have one or more members, service accounts, groups, or machines removed using the PowerShell “Remove-ADGroupMember” cmdlet. The stated cmdlet uses the “-identity” parameter to specify the Active Directory group that contains the users who need to be removed.

The following article will overview the PowerShell “Remove-ADGroupMember” cmdlet.

How to Use the Remove-ADGroupMember (ActiveDirectory)?

The cmdlet “Remove-ADGroupMember” is responsible for deleting or removing members from an Active Directory group.

Let’s explain the stated cmdlet with the help of provided examples below!

Example 1: Use the “Remove-ADGroupMember” Cmdlet to Remove a Member From a Group

Execute the below-given command to remove a member from a group:

Remove-ADGroupMember -Identity <Group Name> -Members <Username>

According to the above-provided command:

  • First, write the “Remove-ADGroupMember” cmdlet.
  • Then, specify the “-Identity” parameter and assign it the group name whose member you want to remove.
  • Then, specify the “-Members” parameter and provide it the username to be removed from the group.

Example 2: Use the “Remove-ADGroupMember” Cmdlet to Remove Multiple Members From a Group

To remove multiple users from a specified group, run the following command:

Remove-ADGroupMember -Identity <Group Name> -Members <User_1>,<User_2>

In the above-given command:

  • Initially, specify the “Remove-ADGroupMember” cmdlet along with the “-Identity” parameter having the group name assigned to it.
  • After that, use the “-Members” parameter and assign it to the two users to be removed separated by a comma.

Example 3: Use the “Remove-ADGroupMember” Cmdlet to Remove a Distinguished User From a Group

In order to remove the distinguished user from a group, execute the below-given command:

Get-ADGroup -Server <Server address> -Identity <Group Name> | Remove-ADGroupMember -Members <Distinguished Username>

According to the above command:

  • First, mention the “Get-ADGroup” cmdlet.
  • Then, write the “-Server” parameter to provide the server address along with the “-Identity” parameter having the group name assigned to it.
  • After that, add the pipeline “|” and the “Remove-ADGroupMember” cmdlet.
  • Lastly, specify the “-Member” parameter and assign it the distinguished username.

That was all about the “Remove-ADGroupMember” cmdlet in PowerShell.

Conclusion

The “Remove-ADGroupMember” cmdlet is responsible for removing or deleting users, groups, or service accounts from an Active Directory group. This blog provided a brief explanation of the “Remove-ADGroupMember” with the help of several examples.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.