Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some options do not work correctly in Sysprep mode #106

Closed
Raphire opened this issue Aug 2, 2024 · 6 comments
Closed

Some options do not work correctly in Sysprep mode #106

Raphire opened this issue Aug 2, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@Raphire
Copy link
Owner

Raphire commented Aug 2, 2024

Describe the bug
Some options don't apply to any accounts if the script is run in Sysprep mode within the Windows Audit Mode environment.

  • Hide or change the search icon/box on the taskbar.
  • Hide the gallery section from the File Explorer sidepanel.
  • Restore the old Windows 10 style context menu.

To Reproduce
Steps to reproduce the behavior:

  1. Start fresh installation of Windows 11
  2. Enter audit mode during OOBE (Ctrl + Shift + F3)
  3. Execute the script in Sysprep mode & select the options mentioned above
  4. Reboot
  5. Go through OOBE

Expected behavior
The above mentioned options should apply to the account after going through OOBE

@Raphire Raphire added the bug Something isn't working label Aug 2, 2024
@Raphire Raphire self-assigned this Aug 2, 2024
@Raphire
Copy link
Owner Author

Raphire commented Aug 20, 2024

After testing this I have been able to determine the script does apply the registry changes correctly to the default user profile. It seems however that these changes are not copied over to new users. I have been looking for alternative ways to apply these changes, but no luck so far.

@sean-sauve
Copy link

@Raphire, this might not fix your problem because you did say the change took effect properly, but you might try doing garbage collection first before closing the default registry hive. This is how I've done it in the past to ensure the hive takes effect properly. I had to do this during an Autopilot process or even though the registry got the change on the default hive the user that logged in wouldn't get the changed value.

        # $ITErrorCodes is a hashtable with keys with the friendly names of status codes and values for their errorcode number.  These lines can be omitted in your use case, this is just how my code worked.
        $unloaded = $false
        $attempts = 0
        $exitCode = $ITErrorCodes.Success
        while ((-not $unloaded) -and ($attempts -le 10)) {
            $attempts += 1
            Write-Host "Unloading the default user registry hive.  Attempt $attempts."
            [gc]::Collect()
            Start-Sleep -Seconds 5
            & reg.exe unload "$ITDefaultUserHiveLoad"
            $unloaded = $?
        }
        if (-not $unloaded) {
            Write-Warning "Unable to dismount default user registry hive at $ITDefaultUserHiveLoad.  Manual dismount required"
            Write-Warning "Setting exit code to $($ITErrorCodes.SuccessRebootRequired) SuccessRebootRequired"
            $exitCode = $ITErrorCodes.SuccessRebootRequired
        }

@sean-sauve
Copy link

Here's a better explanation. Apparently you're also supposed to close open handles before doing the garbage collection.

https://dansonnenburg.wordpress.com/2022/03/22/setting-value-in-the-default-user-registry-hive/

@Raphire
Copy link
Owner Author

Raphire commented Aug 28, 2024

@sean-sauve Thanks for the additional info and an example of your implementation. I am planning on reworking the way the script applies registry edits to also tackle #72.

@LuCarhub
Copy link

LuCarhub commented Sep 2, 2024

I think it's the same I read on the forum at the end of https://ccmexec.com/2021/10/modifying-windows-11-start-button-location-and-taskbar-icons-during-osd-autopilot/ and I reported on thread #104

Raphire added a commit that referenced this issue Sep 4, 2024
…tion pane

Fixed certain options not working in Sysprep mode, see #106
@Raphire
Copy link
Owner Author

Raphire commented Sep 4, 2024

With 6b7c4db the following options now work in Sysprep mode:

  • Hide or change the search icon/box on the taskbar.
  • Hide the gallery section from the File Explorer sidepanel.
  • Restore the old Windows 10 style context menu.

Please note that these changes are applied to the user account after the OOBE, this means that they will have to sign-out and back in before the changes are visible.

@Raphire Raphire closed this as completed Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants