Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› RunOnce
Cyber Security

RunOnce

← Back to Glossary
By NHI Mgmt Group Updated November 18, 2026 Domain: Cyber Security

RunOnce is a Windows registry mechanism that runs a command one time the next time a user signs in. It is used for per-user or per-machine startup tasks, and the entry is removed or ignored after execution, so access to the command path and script content matters.

What RunOnce Is Used For

RunOnce is a Windows registry mechanism for one-time execution at the next user sign-in. Administrators and software installers use it to defer setup tasks until a logon event is available, which makes the mechanism simple but also sensitive to who can create, modify, or remove the entry.

How RunOnce Works in Windows

RunOnce entries are evaluated during user logon, then removed or ignored after they have been processed. That design makes them useful for provisioning, repair, cleanup, and first-run configuration, but it also means the timing, execution context, and command line content all matter. A one-time launcher is not a persistent service; it is a transient startup action with a narrow execution window.

Because the command is executed from registry data, the security of the referenced path, script, and dependencies is part of the control surface. If the command points to writable locations, inherited environment paths, or scripts that can be swapped out, the registry entry can become a launch point for unintended code execution.

Security Implications of RunOnce

RunOnce is often benign, but it is still an execution mechanism that can be abused when registry write access is available to the wrong account or when startup scripts are staged insecurely. The risk is not the name of the key itself, but the fact that it can trigger code automatically at sign-in under a predictable user context.

In practice, defenders should treat RunOnce entries as part of startup-authorisation review, especially on shared systems or endpoints with local administrator access. Windows hardening guidance and control catalogues such as NIST SP 800-53 Rev 5 Security and Privacy Controls and CIS Benchmarks both support the broader principle of limiting startup execution paths and protecting configuration integrity.

RunOnce Abuse, Persistence, and Detection

Attackers value RunOnce because it can provide a low-friction execution trigger after logon, which may help with persistence, staging, or re-launching code after a reboot. The mechanism is especially attractive when it points to scripts in user-writable directories or when registry permissions allow silent modification.

Detection usually focuses on registry change monitoring, process creation after logon, and review of unusual paths or encoded command lines. MITRE ATT&CK Enterprise Matrix is useful for mapping these behaviours to logon-based persistence and follow-on execution patterns, while Windows event telemetry can help confirm whether the entry actually fired and what child process chain followed.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5CM-6 — Configuration SettingsRunOnce depends on secure startup configuration and registry integrity.
AC-6 — Least PrivilegeRunOnce abuse depends on excessive write access to executable configuration.
SI-4 — System MonitoringRunOnce abuse is detected through registry and process monitoring after sign-in.
Recommendation — Harden startup and logon execution settings, then restrict who can modify them. Limit registry write access to only the accounts that need to create one-time startup actions. Monitor registry changes and post-logon process execution for unexpected RunOnce activity.
CIS Controls v8CIS-5 — Account ManagementRunOnce misuse often follows from excessive local or administrative account capability.
CIS-8 — Audit Log ManagementRunOnce needs logging to confirm execution and investigate suspicious changes.
Recommendation — Restrict and review account privileges that can create or alter startup execution paths. Collect and retain logs that show registry modification and follow-on process execution.

Practitioner Guidance

What to watch for: Review RunOnce entries as executable configuration, not just registry metadata. A legitimate installer task should have a clear owner, an expected path, and a command that does not depend on weak file permissions or ambiguous script locations.

Governance implication: If your environment uses RunOnce for deployment or remediation, define who may create these entries, what paths are permitted, and how they are validated before sign-in. If you cannot explain why an entry exists, treat it as an execution-risk artefact that deserves investigation rather than assuming it is harmless.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org