I am using Microsoft Deployment Toolkit to install Windows 7 on computers quickly and consistently. I was interested in adding a little polish and branding the finished product. The only real stumbling block I ran into was setting a default wallpaper on Windows 7. The usual tricks of editing the Default user profile or that profile’s NTUser.dat file (HKey_Current_User hive) did not work. When I researched the issue, I found plenty of people looking and a number of suggestions that did not work. One of my requirements that discards many of the suggestions is that I want to allow the end user to change the wallpaper whenever they want. Using Group Policy would be a very easy solution but would not allow end users to change the wallpaper later.
In Windows 7, you can right-click on the Desktop and go to Personalize. From there, you can specify the wallpaper background image or images along with other settings and compile them into a theme.
You can also script the setting through the Registry by setting a key to point to a particular image for the account you are logged into:
reg add “HKCUControl PanelDesktop” /v Wallpaper /f /t REG_SZ /d C:folderbackground.jpg
There are also other registry keys that will point to the current image which can be misleading.
HKCUSoftwareMicrosoftInternet ExplorerDesktopGeneral | WallpaperSource | Reg_SZ | C:pathtoimage.jpg
By setting it through the Registry, the change won’t take effect until next log on and the command to refresh the desktop no longer seems to take effect.
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
You can try replacing the image in the default profile but it is overridden during profile creation. C:Users[username]AppDataRoamingMicrosoftWindowsThemes
The source for this image is C:WindowsWebWallpaperWindowsimg0.jpg. You can take ownership of the file and modify the permissions or replace it in Windows PE with a 1920 x 1200, 96 dpi, 24 bit image. I could accomplish this manually but could not get the process to work successfully as a part of the MDT task sequence. The name of the game is automation, and just to set the default wallpaper was not worth the additional time and steps.
One solution to setting the default Wallpaper through the HKCUControl PanelDesktop Wallpaper key in a script in the default RunOnce key but it seems clunky and would not have an immediate effect.
The next step to a solution is to change the focus from the wallpaper and look at the entire theme. With Windows 7, you can specify your theme settings and then save it as a theme or save it as a theme for sharing. The difference between the two is that, saving as a theme points to the image’s location on the hard drive while ‘for sharing’ bundles the image along with it.
I saved the theme and the image I was using. If you double-click on the theme, it configures the theme for the current user but it also opens the Personalization window. This made it so I couldn’t just script the .theme file to be executed in the RunOnce key without this slight annoyance. It was suggested in a thread that you just make it part of the script to use TSKill to kill the Explorer process immediately after.
Finally, I found the Registry key that would work by default for new users:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionThemes
On 64-bit Windows, this key exists twice but the 64bit Node has no effect. It needs to be set in the same place as the 32-bit Windows.
HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionThemes
I changed the InstallTheme value to the location of the .theme file that I saved. C:ITWallpaper404TS.theme
In case you wish to restore it, the default value is C:WindowsresourcesThemesaero.theme
Setting this value worked to create the default wallpaper for new accounts immediately while allowing them to customize it at any time.
My full solution for integrating with MDT was to modify the Windows 7 task sequence for both 32-bit and 64-bit installs. I added 3 command line steps to the task sequence right before it installs Windows Updates. When the computer comes back up after the next restart the local Administrator is using the desired wallpaper and any new accounts will also use the same theme.
- Copy the files from the deployment locally: Powershell.exe -command “Copy-Item %DEPLOYROOT%CustomWallpaper -Destination C:ITWallpaper -Recurse”
- Set the registry key for all new users: REG ADD HKLMSoftwareMicrosoftWindowsCurrentVersionThemes /v InstallTheme /t REG_SZ /d C:ITWallpaper404TS.theme /f
- Set the registry key for the current user (Administrator): REG ADD “HKCUControl PanelDesktop” /v Wallpaper /f /t REG_SZ /d C:ITWallpaper404TSrocks.jpg
From some limited testing, changing the InstallTheme key did not work on Windows 8 to set the default wallpaper for new users. I will have to do more research on this shortly when I start deploying Windows 8 with MDT.