1

I would like to replace the default Desktop background image with a darker solid color, on an unregistered Windows 10 Pro (Insider Preview) edition. I am testing various terminal coloring schemes, and the default image is annoyingly too bright and not solid. I have tried all sorts of registry settings and also renaming and replacing the image, but it's always the same.

A few things I tried:

# Take (user) owbership of file:
takeown /F C:\Windows\Web\Wallpaper\Windows\img0.jpg
# C:\Windows\Web\Wallpaper\Windows\img0.jpg

$key = 'HKCU:\Control Panel\Colors'         # 
$key = 'HKCU:\Control Panel\Desktop'        # 
$key = 'HKCU:\Control Panel\Desktop\Colors' # 

# Doesn't seem to effect the Desktop...only console
Set-ItemProperty -Path $key -Name 'Window' -Value '1 36 86'
# reset to default
Set-ItemProperty -Path $key -Name 'Window' -Value '255 255 255'

How can I use PowerShell to set the correct registry item(s) to remove the background image and get a solid color?

2
  • 1
    $key = "HKCU:\Control Panel\Desktop";Set-ItemProperty -Name WallPaper -Path $key -Value '' – JosefZ Dec 20 '18 at 15:49
  • Thanks @JosefZ I must have found the solution while you were typing. – not2qubit Dec 20 '18 at 16:12
1

Indeed I found two methods. One using CMD-R to run some windows magic, and another by setting the PATH value to null with ('').

However, apparently there is another registry item containing the path in hex encoded form, in HKCU:\Control Panel\Desktop\TranscodedImageCache, that you can see by the rudimentary hex conversion.

# Set the wallpaper PATH to ''
$key = 'HKCU:\Control Panel\Desktop'
Set-ItemProperty -Path $key -Name 'WallPaper' -Value ''

# Re-start windows Explorer:
Stop-Process -ProcessName explorer

# Using `CMD+R` and run : 
shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921} -Microsoft.Personalization\pageWallpaper

# Getting the "Transcoded" PATH:
$TIC=(Get-ItemProperty 'HKCU:\Control Panel\Desktop' TranscodedImageCache -ErrorAction Stop).TranscodedImageCache
[System.Text.Encoding]::Unicode.GetString($TIC) -replace '(.+)([A-Z]:[0-9a-zA-Z\\])+','$2'

#C:\Windows\Web\Wallpaper\Windows\_img0.jpg

Also related to this answer.

  • You need to restart windows explorer.exe (use Sysinternal's Process Explorer or PS with: Stop-Process -ProcessName explorer) in order for registry changes to take effect.

UPDATE: 2020-01-09

  • You don't need to re-start explorer, nor compile anything via PoweShell, ... almost. From THIS blog and this SESU answer, I found a fantastic one-liner:
add-type -typedefinition "using System;`n using System.Runtime.InteropServices;`n public class PInvoke { [DllImport(`"user32.dll`")] public static extern bool SetSysColors(int cElements, int[] lpaElements, int[] lpaRgbValues); }"

# Now to get your desktop to instantly turn purple, run it with:
[PInvoke]::SetSysColors(1, @(1), @(0xAA40C0))
# Or tack it on the end of above for a true one-line experience.

Notes from author: "This doesn't affect the Registry, so if you want the change to stick, you need to also write the new data to Registry yourself."

2
  • 1
    Good point! In this case, you needn’t to restart explorer.exe. Right-click the desktop + Refresh should suffice – JosefZ Dec 20 '18 at 17:26
  • Cool! Is there a powershell command to refresh desktop? – not2qubit Jan 9 '20 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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