Closed
Guard newUsers.ps1 against re-running on accidental Windows profile reset#1
Conversation
…ly reset by Windows When Windows 11 24H2/25H2 accidentally resets an existing user's profile (e.g., after sleep/wake), the new profile inherits the Default user hive's RunOnce entry which Atlas places for new-user setup. This causes newUsers.ps1 to run again, unexpectedly logging the user out and wiping their current profile settings. Fix: after a successful first-time run, record the user's SID in HKLM\SOFTWARE\AtlasOS\UserSetup. On subsequent runs (e.g., after a profile reset), the script checks for this persistent marker and exits silently instead of forcing a logoff. Genuine new user accounts (with a different SID) are unaffected. Addresses: Atlas-OS#1607 Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue 1607 in forked AtlasOS repo
Guard newUsers.ps1 against re-running on accidental Windows profile reset
Mar 10, 2026
Stensel8
marked this pull request as ready for review
March 10, 2026 10:29
Owner
|
Testing and reviewing this change first. This will not be merged in, unless it is deemed stable. |
Owner
|
@copilot apply changes based on the comments in this thread |
- Move the idempotency guard before self-elevation so that already-configured accounts silently exit without triggering a UAC prompt - Remove the Write-Host from the silent exit path (no output during logon) - Use New-ItemProperty -PropertyType DWord instead of Set-ItemProperty -Type DWORD which does not support the -Type parameter - Add comment clarifying the marker is written at the very end (after all setup steps succeed) to prevent permanently skipping a partially-configured account Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com>
Author
All 4 review comments applied in commit |
Owner
|
Superseded by Atlas-OS#1644 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Questions
Describe your pull request
On Windows 11 24H2/25H2, a sleep/wake cycle can trigger Windows to recreate an existing user's profile from the Default user template. Since Atlas plants a
RunOnceentry in the Default user hive,newUsers.ps1fires again on the recreated profile — forcing a logoff and wiping the user's settings as if they were a brand-new account.