1

Whenever I'm installing Windows on new devices there are a lot of changes to be made which cost a lot of time. So I wanted to make some scripts which do exactly that for me.

For the past few days I have been searching for registry keys I can create/change for basic settings for Windows 10 (changing desktop wallpaper, small tray icons, etc). I found some and also have created my own, which I then have added together into a batch script.

I don't have much experience with batch scripts, but I wrote one, which when its executed as administrator will 'take' the keys in the folder the script is in, write them to the paths, then stop explorer.exe to and start it again for the changes to be applied.

@echo off

reg import %~dp0TaskViewButton.reg
reg import %~dp0SearchboxTaskbar.reg
reg import %~dp0RemoveContacsFromTaskbar.reg
reg import %~dp0EnableAutoTray.reg
reg import %~dp0Wallpaper.reg
reg import %~dp0TaskbandFavorites.reg
reg import %~dp0TaskbandFavoritesChanges.reg
reg import %~dp0TaskbandFavoritesResolve.reg

taskkill /f /im explorer.exe
start explorer.exe

pause

When I executed the script every key was successful excluding DesktopWallpaper.reg. FOr DesktopWallpaper.reg I created a new key folder named System with this string value named Wallpaper in HKCU\Software\Microsoft\Windows\CurrentVersion\Policies as it was the only possibility that worked for me.
It worked until I exported and put it into that script. The only thing I added and changed to that .reg file was the name and a RGB value which should be the color of the wallpaper. This is what the file looks like:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"Wallpaper"="46 141 239"

The command prompt shows an error for that file. When I double click the .reg file it tells me that an error occured while trying to access the registry as sysadmin. And not only that, executing the script also changes the wallpaper to a solid black. When accessing Personalisation > Background in the settings it tells me *Some settings are hidden or managed by your organization.

I have done some research on this as well and have tried fixing it with gpedit.msc. Apparently when Windows changes some settings they should also be in the Group Policy Editor. I followed some tutorials, but none of them worked for me. Some rules which should be enabled there were 'not configured'.

Any kind of help would be appreciated.

closed as unclear what you're asking by Run5k, harrymc, Ramhound, music2myear, Burgi Mar 13 at 16:42

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    You never asked a specific Question – Moab Feb 27 at 14:57
  • The title is supposed to be a specific question. – Rin Feb 27 at 15:28
  • It is always better to also include it in the body of the question itself. – Moab Feb 27 at 15:42
0

There are a few reasons why that particular registry change doesn't work:

  1. Restarting Windows Explorer (explorer.exe) does not update the background color, only the background image. Updating the background color requires logging out and logging back in.
  2. They keys you should probably be using are:

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Control Panel\Colors]
    "Background"="46 141 239"
    
    [HKEY_CURRENT_USER\Control Panel\Desktop]
    "WallPaper"=""
    
  3. The key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\Wallpaper seems to:

    • only accept local file paths—not colors or UNC paths.
    • override HKEY_CURRENT_USER\Control Panel\Desktop\WallPaper.
    • restrict changing the wallpaper through Personalization -> Background.
    • require all \ be escaped as \\

Not the answer you're looking for? Browse other questions tagged or ask your own question.