> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/keeperpam/endpoint-privilege-manager/deployment/deployment-reference/maintainkeeperaccount-configuration.md). Agents can also search and read this documentation through its [MCP server](https://docs.keeper.io/~gitbook/mcp).

# MaintainKeeperAccount Configuration

The MaintainKeeperAccount setting controls which account Keeper EPM uses for Windows [privilege elevation policies](https://docs.keeper.io/keeperpam/endpoint-privilege-manager/policies/policy-types/privilege-elevation-policy-type.md). In Keeper EPM v2.5 and later, the default (false) gives each elevation its own temporary administrator account and profile, and true makes Keeper EPM reuse a single retained KeeperUserSession account. In earlier versions, the setting controls whether the KeeperUserSession ephemeral administrator account persists between Keeper EPM service restarts. It exists primarily for Windows environments with specific identity management requirements, most commonly hybrid Azure AD (Microsoft Entra ID) + Intune deployments, and other environments where local account churn causes downstream issues.

By default the setting is disabled. In Keeper EPM v2.5 and later, each approved Windows elevation then uses a newly generated temporary administrator account and profile, which are deleted after the application exits. In earlier versions, Keeper EPM deletes and recreates the KeeperUserSession account on every service restart. This is the correct behavior for most deployments. Enable the setting only when a stable local account is required by your environment, or when account churn is causing measurable problems.

### Configuration

The setting lives in the `Settings` section of the Keeper EPM service's `appsettings.json`:

```json
{
  "Settings": {
    "MaintainKeeperAccount": false
  }
}
```

<table><thead><tr><th width="212.3333740234375">Setting</th><th width="92">Type</th><th width="97">Default</th><th>Description</th></tr></thead><tbody><tr><td><code>MaintainKeeperAccount</code></td><td>boolean</td><td><code>false</code></td><td>When <code>true</code>, the KeeperUserSession account persists across service restarts instead of being deleted and recreated.</td></tr></tbody></table>

**Applies to:** Windows. The setting has no effect on macOS or Linux.

**Restart required:** The setting is read at service startup and shutdown. Changes take effect on the next service restart cycle.

**Preferred deployment method:** Rather than editing `appsettings.json` directly on each endpoint, push the setting from a central [Settings Update policy](https://docs.keeper.io/keeperpam/endpoint-privilege-manager/policies/policy-types/advanced-policy-types/update-jobs-policy-type.md).

### When to Enable

#### Enable When

**Hybrid Azure AD + Intune Environments**

Azure AD Connect may sync local accounts on domain-joined or hybrid-joined endpoints. When Keeper EPM creates and deletes administrator accounts, Azure AD sees continuous account churn, with a different SID each time. In Keeper EPM v2.5 and later, the default mode creates a new temporary account for every elevation. In earlier versions, Keeper EPM deleted and recreated KeeperUserSession on each service restart. Symptoms include:

* Azure AD sync delays or backlog
* Intune policies that reference the account's SID losing their target each time the account is recreated
* Compliance alerts triggered by unexpected local-account activity

**Active Directory Environments with Aggressive Sync**

Any AD environment where account changes trigger downstream sync events, external process runs, or audit alerts benefits from a stable account rather than churn.

**Performance-Sensitive Deployments**

Account creation involves SAM database writes, and in Keeper EPM v2.5 and later each default-mode elevation also creates a new Windows profile, which can take longer on devices with a large Default profile (C:\Users\Default). Retaining the account makes subsequent launches faster. In earlier versions, persisting the account eliminates the create-on-start cost on systems with slow SAM operations, or where minimizing service restart time is critical.

#### Keep Disabled (by Default) When

**Standard deployments**

Most Windows deployments, such as standalone workstations, domain-joined systems without Azure AD hybrid join, and environments with no sync sensitivity, should leave this at the default. A fresh temporary account for every elevation (Keeper EPM v2.5 and later), or fresh credentials on every restart (earlier versions), is the cleaner security posture.

**Maximum security requirements**

Environments that require fresh credential material for every elevation (Keeper EPM v2.5 and later) or every restart (earlier versions), or that treat any persistent local admin account as an audit finding, should keep the default.

**Testing and development**

A clean slate between restarts makes reproducing issues easier.

### Behavior Comparison

The tables below describe the KeeperUserSession account on Windows (Keeper EPM versions before 2.5). In Keeper EPM v2.5 and later, the default mode (MaintainKeeperAccount = false) creates a temporary account and profile for each approved elevation and deletes them after the application exits. With MaintainKeeperAccount = true, KUSM reuses a single KeeperUserSession account for all elevations, and elevations are processed one at a time so two applications never share the account and profile at the same time.

#### Default: `MaintainKeeperAccount = false`

<table><thead><tr><th width="150.666748046875">Event</th><th>Behavior</th></tr></thead><tbody><tr><td>Service starts</td><td>Delete any existing KeeperUserSession account, then create a new one with a freshly generated password</td></tr><tr><td>Service stops</td><td>Delete the KeeperUserSession account</td></tr><tr><td>Service crashes</td><td>Orphaned account cleaned up on next startup</td></tr><tr><td>Profile folders</td><td>Orphaned <code>C:\Users\KeeperUserSession.*</code> folders cleaned up by the profile-folder cleanup job</td></tr></tbody></table>

Advantages: fresh credentials on each restart; no persistent local admin account when the service is stopped; cleaner security posture.

#### Enabled: `MaintainKeeperAccount = true`

<table><thead><tr><th width="166.6666259765625">Event</th><th>Behavior</th></tr></thead><tbody><tr><td>Service starts</td><td>Reuse the existing KeeperUserSession account (password rotated)</td></tr><tr><td>Service stops</td><td>Keep the KeeperUserSession account</td></tr><tr><td>Service crashes</td><td>Account remains; reused on restart</td></tr><tr><td>Profile folders</td><td>Orphaned profile folders still cleaned up (though far fewer are generated)</td></tr></tbody></table>

Advantages: faster startup (no delete/create cycle); stable account SID for Azure AD sync and Intune policy targeting; no sync churn.

### Security Considerations

The KeeperUserSession password is cryptographically generated, protected at rest via DPAPI on Windows, rotated on each service restart (or each elevation, when the account is persistent), and never exposed to end users or written to logs.

When `MaintainKeeperAccount = true`, additional considerations apply:

* **Account persistence risk:** A local administrator account remains on the endpoint when the Keeper EPM service is stopped. If the service is uninstalled without cleanup, the account may remain. Ensure your uninstall procedures include account removal.
* **Auditing:** Include KeeperUserSession in regular local-admin audits. Monitor for authentication attempts or process launches that were not initiated by Keeper EPM.
* **Access restriction:** Where possible, restrict the account via Group Policy — for example, deny interactive logon, deny network logon, deny logon through Remote Desktop Services. Keeper EPM only needs the account for local process elevation.

### Orphaned Profile Folders

On Windows, deleting an account can leave behind residual profile folders under C:\Users, for example folders named KeeperUserSession\* (earlier versions and retained-account mode) or KUSM\* (Keeper EPM v2.5 and later):

* `C:\Users\KeeperUserSession`
* `C:\Users\KeeperUserSession.12-30-HOSTNAME`
* `C:\Users\KeeperUserSession.12-30-HOSTNAME.000`, `.001`, `.002`, and so on

These are cosmetic — they don't affect Keeper EPM functionality — but they can accumulate on the disk over time, especially on endpoints that restart the service frequently.

Keeper EPM automatically cleans them up via the **ephemeral-orphan-profile-folders-cleanup** scheduled job, which runs every 5 minutes. The job deletes any folder under `C:\Users` whose name is exactly `KeeperUserSession` or begins with `KeeperUserSession.`, and removes the matching `ProfileList` registry entries under `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList`. In Keeper EPM v2.5 and later, KUSM removes each elevation's profile and account by its account SID after the application exits, and this job ships disabled, so enable it only to clean up residual folders. Orphan-folder cleanup does not run at service startup.

Enabling `MaintainKeeperAccount = true` largely eliminates the churn that causes these folders to accumulate in the first place.

### Troubleshooting

#### Account Is Deleted Despite MaintainKeeperAccount Being True

**Diagnosis:** Check the Keeper EPM service logs at startup. When the setting is correctly enabled, you will see:

```
MaintainKeeperAccount is enabled - skipping account deletion on startup (account will be reused)
```

If instead you see:

```
Starting KeeperUserSession ephemeral account cleanup
KeeperUserSession deleted or did not exist
```

then the setting is being read as `false`.

**Resolution:**

1. Confirm the setting is in the `Settings` section of `appsettings.json`, not another section
2. Confirm the JSON is syntactically valid (a syntax error causes the file to fail to load and all settings to fall back to defaults)
3. Restart the Keeper EPM service and re-check the logs
4. If you push settings via a SettingsUpdate policy, confirm the policy has run and the merge succeeded

#### Azure AD Reports Frequent Account Additions/Deletions

**Cause:** Keeper EPM is creating and deleting accounts (on each elevation in Keeper EPM v2.5 and later, or on each service restart in earlier versions), and Azure AD Connect is syncing each event.

**Resolution:**

1. Enable `MaintainKeeperAccount = true`
2. Confirm Azure AD Connect sync scope doesn't include the KeeperUserSession account (either by scope filter or by excluding it explicitly)
3. Consider excluding local system accounts from sync where organizational policy allows

#### Orphaned KeeperUserSession Folders Accumulating in C:\Users

**Cause:** Either the cleanup job is not running, or new folders are being created faster than cleanup can remove them.

**Resolution:**

1. Verify the Keeper EPM service is running as `SYSTEM` and has permission to modify `C:\Users`
2. Verify the **ephemeral-orphan-profile-folders-cleanup** job is enabled and scheduled
3. If churn is the underlying cause, enable `MaintainKeeperAccount = true`
4. For manual cleanup:

```powershell
# Run as administrator
Get-ChildItem "C:\Users" -Filter "KeeperUserSession*" -Directory | Remove-Item -Recurse -Force
```

Also remove the matching entries under `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList` if any remain.

### Recommendations

1. **Assess your environment first.** Before enabling, confirm you are actually experiencing Azure AD sync churn, Intune SID targeting failures, or measurable startup delays. Don't enable prophylactically.
2. **Document which endpoints have it enabled and why.** Useful for security audits, troubleshooting, and compliance reporting.
3. **Test in staging.** Enable on a non-production endpoint first, verify the Azure AD or Intune symptoms improve, and confirm security monitoring still captures account activity as expected.
4. **Include KeeperUserSession in regular security audits** whenever the account is persistent.
5. **Deploy via SettingsUpdate policy** rather than manual `appsettings.json` edits, to keep configuration centralized and reproducible.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.keeper.io/keeperpam/endpoint-privilege-manager/deployment/deployment-reference/maintainkeeperaccount-configuration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
