# Local Group Remove All Except

> Removes all members from a local group except those whose account name matches one or more wildcard patterns.

Source: https://docs.capaone.com/capaone/application-manager/powerbricks/local-group-remove-all-except/  
Product: CapaOne — a separate CapaSystems product; do not apply this page to any other.

Removes all members from a local group except those whose account name matches one or more wildcard patterns.

## Parameters

#### Group Name
*Required*

Specifies the local group name or SID to clean up. For example: Administrators or S-1-5-32-544.

#### 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

- **Category:** User management
- **Brick ID:** `UsrMgr-LocalGroup-RemoveAllExcept`

## Raw JSON definition

**JSON**

```json
{
  "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.",
      "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.9.1.1"
}
```
