Skip to content

fix: sync LockScreen service with script migration (Atlas-OS/Atlas#1666) - #67

Closed
Stensel8 wants to merge 3 commits into
Atlas-OS:mainfrom
Stensel8:lockscreen-fixes
Closed

fix: sync LockScreen service with script migration (Atlas-OS/Atlas#1666)#67
Stensel8 wants to merge 3 commits into
Atlas-OS:mainfrom
Stensel8:lockscreen-fixes

Conversation

@Stensel8

@Stensel8 Stensel8 commented May 23, 2026

Copy link
Copy Markdown

Old version: #66.

This brings the Toolbox's LockScreenConfigurationService in sync with the script migration done in Atlas-OS/Atlas#1666.

The Atlas scripts were updated to handle both NoLockScreen and NoChangingLockScreen registry values. Without NoChangingLockScreen being cleared on re-enable, the lock screen settings stayed greyed out in Windows Settings ("managed by your organization") even after toggling the lock screen back on via the Toolbox.

Changes:

  • Enable() now also deletes NoChangingLockScreen alongside NoLockScreen, which is what kept Settings greyed out
  • Disable() now also sets NoChangingLockScreen = 1 to be consistent with what the scripts do
  • Both Disable() and Enable() now reference the .ps1 script paths instead of the deleted .cmd files

Tested locally: toggling off and on via the Toolbox correctly sets and clears both registry values, and the lock screen works as expected after re-enabling.

This fixes: #68

Related: Atlas-OS/Atlas#1664
Related: Atlas-OS/Atlas#1666
Related: #68

Copilot AI review requested due to automatic review settings May 23, 2026 18:51
@Stensel8 Stensel8 mentioned this pull request May 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Stensel8
Stensel8 requested a review from Copilot May 25, 2026 17:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

@Stensel8

Copy link
Copy Markdown
Author

@TheyCreeper, got time for this one?

Ty ;)

RegistryHelper.SetValue(PERSONALIZATION_KEY_NAME, NO_CHANGING_LOCK_SCREEN_VALUE_NAME, 1, Microsoft.Win32.RegistryValueKind.DWord);
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, STATE_VALUE_NAME, 0);
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, "path", @$"{Environment.GetEnvironmentVariable("windir")}\AtlasDesktop\4. Interface Tweaks\Lock Screen\Hide Lock Screen.cmd");
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, "path", Path.Combine(LockScreenScriptDir, "Hide Lock Screen.ps1"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literally invalid. The script is a .cmd, not .ps1

RegistryHelper.DeleteValue(PERSONALIZATION_KEY_NAME, NO_CHANGING_LOCK_SCREEN_VALUE_NAME);
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, STATE_VALUE_NAME, 1);
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, "path", @$"{Environment.GetEnvironmentVariable("windir")}\AtlasDesktop\4. Interface Tweaks\Lock Screen\Show Lock Screen (default).cmd");
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, "path", Path.Combine(LockScreenScriptDir, "Show Lock Screen (default).ps1"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here, its .cmd, not .ps1

@TheyCreeper

Copy link
Copy Markdown
Member

Correction: new-update has those script as .ps1 for some reason, which I don't believe is intended

@Stensel8

Copy link
Copy Markdown
Author

See: Atlas-OS/Atlas#1666

As mentioned above.

@Stensel8

Stensel8 commented Jul 16, 2026

Copy link
Copy Markdown
Author

Correction: new-update has those script as .ps1 for some reason, which I don't believe is intended

That was also part of an earlier PR.

In my opinion, we shouldn't use .cmd / BAT anymore for new scripts as it has its limitations. Also, some regkeys and error handling could not be set in a way that the errors would be catched :)

Your Atlas Toolbox still misses some newer regkeys / API's that Windows has added in the meantime to managed the LockScreen GPO's.

The result is that, the AtlasDesktop scripts work fine now, because they are migrated. This AtlasToolbox doesn't.

@TheyCreeper

TheyCreeper commented Jul 16, 2026

Copy link
Copy Markdown
Member

I reverted those changes. See d21ecf5

In the cases where we do need error handling, we use a .cmd which calls a .ps1 in AtlasModules. There is no need for error handling in registry editing. We've never had any issues with those and I doubt we'll get any in the future

I will probably have some kind of module which checks for admin and does the state switching since that could be useful in powershell, but otherwise we'll continue using .cmd

@Stensel8

Stensel8 commented Jul 16, 2026

Copy link
Copy Markdown
Author

Fair enough. I understand the need for simplicity.

However, PowerShell is far more readable and gives you access to a more modern and more secure way of handling things. CMD is a dead horse that still exists for the legacy and enterprise support.

As how they've been deprecating WMIC and VBS, the CMD suite will follow soon.

"Also want to note that the changes made were only to this script, not to others. It's kinda stupid to have every script be .cmds and then this one is .ps1 for no apparent reason."

No, not really. Because a teammate of you once said the following:

"This is broadly aligned with where we are already taking the Atlas Playbook. We have been moving more logic into PowerShell modules, making scripts reusable across install and newUsers.ps1, improving state/preference handling, and cleaning up scripts that return unreliable error levels." in: https://github.com/orgs/Atlas-OS/discussions/1645.

The thing is that Microsoft recommends users to gradually migrate to .PS1. Doing super big PR's with huge diffs is not maintainable for reviewers. So, it's not "stupid". But thanks for your opinion.

Also, I saw that the path Atlas is going (the na-jack branches), is also more and more PS1 native. When I saw this, I was migrating and transitioning my versions as well, in order to better align with your future versions.

We should be prepared for the case if they ever pull the plug out of CMD. Because, they told that PowerShell is the current scripting and automation language. Do not forget that CMD was an invention of the MS-DOS era.

Back when the dinosaurs lived ;)

Have a great one and keep up the good work on Atlas.

@Stensel8 Stensel8 closed this Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: The Lockscreen enable/disable script is not working as expected

3 participants