Removes users or groups from a local group.
Remove-GroupMember [-Name] <String> [-Member] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
You would think it's pretty easy and straight-forward to remove users/groups from a local group, but you would be wrong. The quick solution is to use
net localgroup, but that won't accept user/group names longer than 24 characters. This means you have to use the .NET Directory Services APIs. How do you reliably remove both users and groups? What if those users are in a domain? What if they're in another domain? What about built-in users? Fortunately, your brain hasn't exploded.
So, this function removes users or groups from a local group.
If the user or group is not a member, nothing happens.
Remove-GroupMember is new in Carbon 2.0.
|Name||Type||Description||Required?||Pipeline Input||Default Value|
The group name.
The users/groups to remove from a group.
|CommonParameters||This cmdlet supports common parameters. For more information type
Remove-GroupMember -Name Administrators -Member EMPIRE\DarthVader,EMPIRE\EmperorPalpatine,REBELS\LSkywalker
Removes Darth Vader, Emperor Palpatine and Luke Skywalker from the local administrators group.
Remove-GroupMember -Name TieFighters -Member NetworkService
Removes the local NetworkService account from the local TieFighters group.