How to change theme in Windows 7 with Powershell script?
- by Greg McGuffey
I would like to have a script that would change the current theme of Windows 7. I found the registry entry where this stored, but I apparently need to take some further action to get windows to load the theme. Any ideas?
Here is the script that I'm trying to use, but isn't working (registry updated, but theme not changed):
######################################
# Change theme by updating registry. #
######################################
# Define argument which defines which theme to apply.
param ( [string] $theme = $(Read-Host -prompt "Theme") )
# Define the themes we know about.
$knownThemes = @{ "myTheme" = "mytheme.theme"; "alien" = "oem.theme" }
# Identify paths to user themes.
$userThemes = " C:\Users\yoda\AppData\Local\Microsoft\Windows\"
# Get name of theme file, based on theme provided
$themeFile = $knownThemes["$theme"]
# Build path to theme and set registry.
$newThemePath = "$userThemes$themeFile"
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\"
Set-ItemProperty -path $regPath -name CurrentTheme -value $newThemePath
# Update system with this info...this isn't working!
rundll32.exe user32.dll, UpdatePerUserSystemParameters
Thanks!