Share via

Setting Wallpaper and Theme for manually created local user after setup of an Image created with Sysprep

Maik 0 Reputation points
2025-09-23T14:28:10.4233333+00:00

I prepared a Windows 11 IoT Image with Sysprep. I set a custom wallpaper and theme, then prepped it with

sysprep /generalize /reboot


In my unattend.xml I set "HideOnlineAccountScreen", "HideLocalAccountScreen" and "CopyProfile" to true. No users are being created through the unattend.xml .

During the setup of windows I am prompted to set a username and password for a local account. After the setup finishes I am logged into the newly created user, but my custom Wallpaper and Theme are not set. Theme is the default one and the wallpaper is always set to "Windows Spotlight".

Is there a way to make this work?

What I already tested was the creation of the user through <UserAccounts> in the unattend file. This works, but I can't use that since the prompt for the username and password is required for what I want to do with the script.

Windows for business | Windows for IoT
0 comments No comments

1 answer

Sort by: Most helpful
  1. Henry Mai 8,220 Reputation points Independent Advisor
    2025-09-23T15:55:27.3366667+00:00

    Hello Maik, I am Henry and I want to share my insight about your issue.

    Can you try to use a FirstLogonCommand in your Unattend.xml. Add the following to your unattend.xml file under the oobeSystem pass. This command will set the registry key for the wallpaper for the current user logging in for the first time.

    <FirstLogonCommands>
        <SynchronousCommand wcm:action="add">
            <Order>1</Order>
            <CommandLine>reg add "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d C:\Windows\Web\Wallpaper\MyCorp\wallpaper.jpg /f</CommandLine>
            <Description>Set Custom Wallpaper</Description>
        </SynchronousCommand>
        <SynchronousCommand wcm:action="add">
            <Order>2</Order>
            <CommandLine>RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters 1, True</CommandLine>
            <Description>Refresh Desktop</Description>
        </SynchronousCommand>
    </FirstLogonCommands>
    

    Another solution is to directly modify the default user registry hive.

    Important: Back Up the Registry Hive Before Editing

    Editing the NTUSER.DAT file is a high-risk operation. A mistake could corrupt the default user profile, which may prevent new users from being created or logging in correctly. Always make a backup first.

    In Audit Mode, navigate to C:\Users\Default\ (you may need to show hidden files).

    Copy the NTUSER.DAT file and paste it in the same folder.

    Rename the copy to NTUSER.DAT.bak.

    If anything goes wrong, you can delete your modified file and restore it from this backup.

    Steps to Modify the Hive:

    1. Open Registry Editor: Press Win + R, type regedit, and press Enter.
    2. Load the Default User Hive:
      • Select the HKEY_USERS branch.
      • Click File > Load Hive....
      • Navigate to C:\Users\Default\
      • elect the NTUSER.DAT file. You may need to enable viewing of hidden files to see it.
      • When prompted for a key name, enter a temporary name, for example, DefaultUser.
    3. Set the Wallpaper:
      • Navigate to HKEY_USERS\DefaultUser\Control Panel\Desktop.
      • In the right pane, find the Wallpaper string value. Double-click it and set its data to the full path of your custom wallpaper image (e.g., C:\Windows\Web\Wallpaper\MyCorp\wallpaper.jpg).
      • Note: Ensure your wallpaper file is in a location that will be accessible on the final system, like C:\Windows\Web.
    4. Set the Theme:
      • To apply a full theme, navigate to HKEY_USERS\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Themes.
      • Find the CurrentTheme string value and set its data to the full path of your custom .theme file.
    5. Unload the Hive:
      • Select the HKEY_USERS\DefaultUser key you created.
      • Click File > Unload Hive....
      • Confirm by clicking Yes. If you get an error, ensure you are not selected on a sub-key within your temporary hive.

    Once this is done, you can proceed with your sysprep /generalize /reboot command.

    I hope this helps you achieve the desired setup. Let me know how it goes, and if this answer is helpful, feel free to hit “Accept Answer” so others can benefit too.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.