CmdID / PowerShell / Cmdlets / Remove
Remove-LocalGroupMember
Removes members from a local group. PowerShell reference
From the PowerShell reference
6 parameters
Alias rlgm
What it does
Removes members from a local group. The Remove-LocalGroupMember cmdlet removes users or groups from a local group. NOTE: The Microsoft.PowerShell.LocalAccounts module is not available in 32-bit PowerShell on a 64-bit system.
Remove-LocalGroupMember [-Group] <LocalGroup> [-Member] <LocalPrincipal[]> [-WhatIf] [-Confirm] [<CommonParameters>]Remove-LocalGroupMember [-Member] <LocalPrincipal[]> [-Name] <String> [-WhatIf] [-Confirm] [<CommonParameters>]Remove-LocalGroupMember [-Member] <LocalPrincipal[]> [-SID] <SecurityIdentifier> [-WhatIf] [-Confirm] [<CommonParameters>]
Remove members from the Administrators group
$members = "Admin02", "MicrosoftAccount\username@Outlook.com", "AzureAD\DavidChew@contoso.com", "CONTOSO\Domain Admins"
Remove-LocalGroupMember -Group "Administrators" -Member $membersIdentifyIts page in the reference: Remove-LocalGroupMember.
Parameters
-GroupSpecifies the security group from which this cmdlet removes members.-MemberSpecifies an array of users or groups that this cmdlet removes from a security group. You can specify users or groups by name, security ID (SID), or LocalPrincipal objects. Specify SID strings in S-R-I-S-S . . . format.-NameSpecifies the name of the security group from which this cmdlet removes members.-SIDSpecifies the security ID of the security group from which this cmdlet removes members.-ConfirmPrompts you for confirmation before running the cmdlet.-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.