Local Group Remove All Except
Removes all members from a local group except those whose account name matches one or more wildcard patterns.
Parameters
Section titled “Parameters”Group Name
Section titled “Group Name”Required
Specifies the local group name or SID to clean up. For example: Administrators or S-1-5-32-544. The SID works on every language. If the group is not found, the brick fails.
Exclude Patterns
Section titled “Exclude Patterns”Required — Default: *Administrator
Specify one or more wildcard patterns for accounts that should remain in the group. Patterns are matched against the full account name as returned by the system (e.g. DOMAIN\Username or .\Username). Use Username to match regardless of domain, or DOMAIN\ to keep all accounts from a specific domain. Allowed values: *Administrator, *Domain Admins.
Details
Section titled “Details”- Category: User management
- Brick ID:
UsrMgr-LocalGroup-RemoveAllExcept
{ "category": "userManagement", "description": "Removes all members from a local group except those whose account name matches one or more wildcard patterns.", "developerVendor": "CapaSystems A/S", "displayName": null, "id": "UsrMgr-LocalGroup-RemoveAllExcept", "name": "Local Group Remove All Except", "parameters": [ { "allowManualInput": false, "defaultValue": "", "defaultValueObject": null, "description": "Specifies the local group name or SID to clean up. For example: Administrators or S-1-5-32-544. The SID works on every language. If the group is not found, the brick fails.", "id": "GroupName", "name": "Group Name", "regExValidation": "", "required": true, "type": "TextBox", "value": null, "values": [], "valuesObject": null }, { "allowManualInput": true, "defaultValue": null, "defaultValueObject": { "id": "*Administrator", "name": "*Administrator" }, "description": "Specify one or more wildcard patterns for accounts that should remain in the group. Patterns are matched against the full account name as returned by the system (e.g. DOMAIN\\Username or .\\Username). Use *Username to match regardless of domain, or DOMAIN\\* to keep all accounts from a specific domain.", "id": "ExcludePatterns", "name": "Exclude Patterns", "regExValidation": "", "required": true, "type": "MultiSelectComboBox", "value": null, "values": [], "valuesObject": [ { "id": "*Administrator", "name": "*Administrator" }, { "id": "*Domain Admins", "name": "*Domain Admins" } ] } ], "powershell": { "base64Encoded": true, "function": "ZnVuY3Rpb2..." }, "type": "powerbrick", "version": "2026.10.14.1"}