---
title: "Active Setup Registry: Set Values for All Users"
description: "Explore the Active Setup registry feature and build a script to set registry values for all users with PowerShell."
canonical: "https://adamtheautomator.com/active-setup-registry/"
---

# Active Setup Registry: Set Values for All Users

> Explore the Active Setup registry feature and build a script to set registry values for all users with PowerShell.

Source: https://adamtheautomator.com/active-setup-registry/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Active Setup Registry: Set Values for All Users](https://adamtheautomator.com/wp-content/uploads/2019/06/using-active-setup-set-registry-value-user-hives-User_icon_2.svg_.png)

# Active Setup Registry: Set Values for All Users

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)18 June 20193 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[PowerShell](/tag/powershell/)[Windows Registry](/tag/windows-registry/)

Table of Contents

*   [The Struggle Without the Active Setup Registry Key](#h-the-struggle-without-active-setup)
*   [How Active Setup and the Registry Works](#h-how-active-setup-and-the-registry-works)
*   [Building a PowerShell Script](#h-building-a-powershell-script)

Tired of struggling how to figure out how to set registry keys and values for all users on Windows? Look no further! The Active Setup registry key is here to save the day!

Related:[How to use PowerShell to Get a Registry Value (PS Drives and .NET)](https://adamtheautomator.com/powershell-to-get-a-registry-value/)

![The Windows registry](https://149584678.v2.pressablecdn.com/wp-content/uploads/2021/04/Registry-2BEditor.png)

Where Active Setup registry lives

## The Struggle Without the Active Setup Registry Key

I’m constantly writing PowerShell scripts to deploy my applications. At least 1/4 of these applications need to have some kind of registry value added or modified in not only _HKEY\_LOCAL\_MACHINE_ but also _HKEY\_CURRENT\_USER_.

As soon as I get some kind of batch file from an application owner referencing _HKEY\_CURRENT\_USER_ I cringe. I cringe because not only do I need to modify a registry value for the currently logged-on user I need to do it for _all_ users on the desktop to ensure all users that use that machine are able to use the software. The Active Setup registry met

Related:[How to Edit the Windows Registry Completely Offline](https://adamtheautomator.com/offline-registry-editor/)

It’s not just as simple as modifying a value in something like _HKEY\_CURRENT\_USER\\Software\\MyApplication_ for two reasons.

1.  I deploy software to systems and the deployment always runs as the local _SYSTEM_ account. The _HKEY\_CURRENT\_USER_ “hive” is only available when a user is logged on. Since I’m “logged on” as _SYSTEM_ I have no access to the “real” logged-on user hive.
2.  Changing a registry value in _HKEY\_CURRENT\_USER_ (even if I _could_ get to it) isn’t enough. To ensure a common experience across any user that logs onto that computer it’s necessary to not only modify a value for the currently logged on user but for _all_ users on that machine.

Don’t worry though there are solutions but first a little background on _HKEY\_CURRENT\_USER_. [_HKEY\_CURRENT\_USER_ is simply a pointer](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc976337\(v=technet.10\)?redirectedfrom=MSDN) to _HKEY\_USERS\\%USERSID%_ and _HKEY\_USERS\\%USERSID%_ is accessible outside of the currently logged-on user.

This means when running a script as _SYSTEM_ on a computer with an interactive logon I can easily modify a registry value inside of the user SID registry key in _HKEY\_USERS_ which is the same thing as _HKEY\_CURRENT\_USER_. Problem solved for the currently logged-on user. Yay!

The next task is changing the value across _all_ user profiles. This is the tricky part. For years I used a VBscript that searched through every user profile on the file system, [loaded the user’s NTUser.dat file, modified what I needed to, and unloaded it](http://www.ghacks.net/2008/03/12/windows-tip-edit-user-registry-of-other-users/). It worked…sometimes.

I found that every now and then there’d be permission problems of some sort and the hive would be stuck in a state of limbo. The next time the affected user logged on their profile got corrupted and anger would ensue. I had to come up with a better solution.

It just so happens that the Active Setup registry key works great.

## How Active Setup and the Registry Works

This is why I started using a feature called [Active Setup](https://www.itninja.com/blog/view/an-active-setup-primer) with the Active Setup registry key. Click through the link to learn the specific of the feature but in a nutshell, it’s a simple method to run a command once for every user (new or existing) on a computer.

When a user logs on, the Active Setup registry kicks in and checks a particular registry key in _HKEY\_LOCAL\_MACHINE_ to see if a matching key exists in the current _HKEY\_CURRENT\_USER_. If not, it executes a command specified in a registry value called `StubPath`. This is a perfect way to implement the [RunOnce method](https://www.microsoft.com/en-us/download/details.aspx?id=53312) for the entire system on a per-user basis.

In my instance, I’m using this technique to place an old-school reg add command in there to create or modify a registry value inside HKEY\_CURRENT\_USER. When Active Setup runs, it always runs in the currently logged-on user context so I now have the opportunity to do whatever I need at that point.

## Building a PowerShell Script

You know I wouldn’t just get you all excited about this cool technique without sharing an automated PowerShell way to implement it, right? 🙂 Here’s what I’ve come up with to make this happen; a [PowerShell function](https://adamtheautomator.com/powershell-functions/ "PowerShell function") that you can call in your script.

I made it as simple as possible. With a single line, you don’t have to worry about all the key paths. It just works across the board. Simply pass a hashtable containing the registry key path, name, value, and the type of registry value you’d like to create/modify and you’re done! If you need to modify more than one value just pass in an array to it and it will change them all.

Hopefully, this script below will help you use Active Setup registry much easier!

[https://github.com/Adam-the-Automator/Scripts/blob/main/Set-RegistryValueForAllUsers.ps1](https://github.com/Adam-the-Automator/Scripts/blob/main/Set-RegistryValueForAllUsers.ps1)

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Factive-setup-registry%2F&text=Active%20Setup%20Registry%3A%20Set%20Values%20for%20All%20Users)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Factive-setup-registry%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Factive-setup-registry%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26995-troubleshoot-dns-issues-powershell-codex.webp)

### [Troubleshoot DNS Issues with PowerShell](/troubleshoot-dns-issues-powershell/)

Troubleshoot DNS issues with PowerShell by testing name resolution, DNS client settings, cache entries, and network connectivity in a repeatable workflow.

![](https://adamtheautomator.com/wp-content/uploads/2025/10/image_2025-10-24_095322075.png)

### [Migrating from PowerShell 6 to 7.5: Breaking Changes/New Features](/migrating-powershell-6-to-7-5/)

Migrate from PowerShell Core 6 to 7.5: breaking changes, features, and testing tips.

![](https://adamtheautomator.com/wp-content/uploads/2025/06/featured-image-6.png)

### [How to Add Timeouts to Pester Tests with PowerShell Runspaces](/pester-test-timeout-runspaces/)

Prevent Pester tests from hanging indefinitely using PowerShell runspaces. Learn to handle variable scoping, module loading, TestDrive access, and stream capture challenges with timeout protection.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
