Run as Local System User
This script will change the desktop background color and wallpaper style.
#To define a particular parameter, replace the 'parameterName' inside itsm.getParameter('parameterName') with that parameter's name
import _winreg
import os
from _winreg import *
Key= r"Software\Microsoft\Windows\CurrentVersion\Policies\System" ## Here give the registry Key path to change the wallpaper style
Key1 =r"Control Panel\Colors"## Here give the registry Key path to change the background colour
Sub_Key= "WallpaperStyle"
Sub_Key1= "Background"
Field= _winreg.REG_SZ ##Here give the field for Background Style
Field1= _winreg.REG_SZ ##Here give the field of Background Colour
value = "3" ##Mention the value for WallpaperStyle. Here 3 is for WallpaperStyle:Fit.
value1 = "255 255 255" ##Mention the value. Here 255 255 255 is to set Background Colour as white.
try:
if not os.path.exists(Key):
key = _winreg.CreateKey(HKEY_CURRENT_USER,Key)
Registrykey= _winreg.OpenKey(HKEY_CURRENT_USER,Key, 0,KEY_WRITE)
_winreg.SetValueEx(Registrykey,Sub_Key,0,Field,value)
CloseKey(Registrykey)
print "Successfully changed wallpaper style"
if not os.path.exists(Key1):
key1 = _winreg.CreateKey(HKEY_CURRENT_USER,Key1)
Registrykey1= OpenKey(HKEY_CURRENT_USER,Key1, 0,KEY_WRITE)
_winreg.SetValueEx(Registrykey1,Sub_Key1,0,Field1,value1)
CloseKey(Registrykey1)
print "Successfully changed bg colour"
except WindowsError:
print "Error"
#print "Rebooting the system to apply the changes"
#os.popen("shutdown -r -t 00")
Comments