-
-
Save Gunslap/fada1bddb0b16fdff64c0490d12bf45c to your computer and use it in GitHub Desktop.
<# | |
************************************************************* | |
* Set Desktoop Background to Default for All Local Profiles * | |
************************************************************* | |
Purpose: | |
This script will loop through all of the user profiles on the | |
local machine and reset the desktop background to the default value in the registry (user hive). | |
Win7 to Win10 USMT doesn't copy over custom wallpapers. | |
So this is often left blank, leaving users with a black background. | |
This is also a good example of how to edit user hive files in PowerShell. | |
#> | |
#Find all the user profiles in the registry | |
$users = Get-ChildItem "C:\Users" | |
#Loop through each profile hive and set the default background | |
foreach($user in $users) | |
{ | |
$ntPath = ($user.FullName + "\NTUSER.DAT") | |
$hiveName = ("HKU\" + $user.Name) | |
$userName = $user.Name | |
reg.exe load $hiveName $ntPath | |
#reset the user's desktop background to default | |
reg.exe add "`"HKEY_USERS\$userName\Control Panel\Desktop\"`" /v Wallpaper /t REG_SZ /f /d 'C:\WINDOWS\web\wallpaper\Windows\img0.jpg' | |
#Uncomment this section if you'd like to reset the theme settings as well: | |
<# | |
reg.exe add "HKEY_USERS\$userName\Software\Microsoft\Windows\CurrentVersion\Themes\" /v ColorSetFromTheme /t REG_DWORD /f /d 1 | |
reg.exe add "HKEY_USERS\$userName\Software\Microsoft\Windows\CurrentVersion\Themes\" /v CurrentTheme /t REG_SZ /f /d "C:\WINDOWS\resources\Themes\aero.theme" | |
reg.exe add "HKEY_USERS\$userName\Software\Microsoft\Windows\CurrentVersion\Themes\" /v InstallTheme /t REG_EXPAND_SZ /f /d "%SystemRoot%\resources\Themes\aero.theme" | |
reg.exe add "HKEY_USERS\$userName\Software\Microsoft\Windows\CurrentVersion\Themes\" /v InstallVisualStyle /t REG_EXPAND_SZ /f /d "%ResourceDir%\themes\Aero\Aero.msstyles" | |
reg.exe add "HKEY_USERS\$userName\Software\Microsoft\Windows\CurrentVersion\Themes\" /v InstallVisualStyleColor /t REG_SZ /f /d "NormalColor" | |
reg.exe add "HKEY_USERS\$userName\Software\Microsoft\Windows\CurrentVersion\Themes\" /v InstallVisualStyleSize /t REG_SZ /f /d "NormalSize" | |
reg.exe add "HKEY_USERS\$userName\Software\Microsoft\Windows\CurrentVersion\Themes\" /v SetupVersion /t REG_SZ /f /d "10" | |
reg.exe add "HKEY_USERS\$userName\Software\Microsoft\Windows\CurrentVersion\Themes\" /v ThemeChangesDesktopIcons /t REG_DWORD /f /d 1 | |
reg.exe add "HKEY_USERS\$userName\Software\Microsoft\Windows\CurrentVersion\Themes\" /v ThemeChangesMousePointers /t REG_DWORD /f /d 1 | |
reg.exe add "HKEY_USERS\$userName\Software\Microsoft\Windows\CurrentVersion\Themes\" /v WallpaperSetFromTheme /t REG_DWORD /f /d 1 | |
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Themes" /v HighContrast /t REG_SZ /f /d "C:\WINDOWS\resources\Themes\aero.theme" | |
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Themes\History\Colors" /v ColorHistory0 /t REG_DWORD /f /d 0x002987cc | |
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers" /v BackgroundType /t REG_DWORD /f /d 0x00000000 | |
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent" /v AccentPalette /t REG_BINARY /f /d a6d8ff0076b9ed00429ce3000078d700005a9e000042750000264200f7630c00 | |
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent" /v StartColorMenu /t REG_DWORD /f /d 0xff9e5a00 | |
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent" /v AccentColorMenu /t REG_DWORD /f /d 0xffd77800 | |
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\DWM" /v ColorizationColor /t REG_DWORD /f /d 0xc40078d7 | |
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\DWM" /v ColorizationAfterglow /t REG_DWORD /f /d 0xc40078d7 | |
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\DWM" /v AccentColor /t REG_DWORD /f /d 0xffd77800 | |
#> | |
[gc]::Collect() | |
#Unload ntuser.dat | |
reg unload "$hiveName" | |
} |
With the following additions resetting the Theme to Windows Default is now working as well - not sure if every entry is really necessary:
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Themes" /v HighContrast /t REG_SZ /f /d "C:\WINDOWS\resources\Themes\aero.theme"
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Themes\History\Colors" /v ColorHistory0 /t REG_DWORD /f /d 0x002987cc
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers" /v BackgroundType /t REG_DWORD /f /d 0x00000000
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent" /v AccentPalette /t REG_BINARY /f /d a6d8ff0076b9ed00429ce3000078d700005a9e000042750000264200f7630c00
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent" /v StartColorMenu /t REG_DWORD /f /d 0xff9e5a00
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent" /v AccentColorMenu /t REG_DWORD /f /d 0xffd77800
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\DWM" /v ColorizationColor /t REG_DWORD /f /d 0xc40078d7
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\DWM" /v ColorizationAfterglow /t REG_DWORD /f /d 0xc40078d7
reg.exe add "HKEY_USERS$userName\Software\Microsoft\Windows\DWM" /v AccentColor /t REG_DWORD /f /d 0xffd77800
That's awesome, thanks for the fix @mchwalt ! I'm sorry it took me 4 months to get back to you.
Thanks a lot - it is working great for setting Wallpaper.
Unfortunately resetting Theme does not work