

So I figured it out that the "dll line" should be repeated at least 5 times - now the code works everytime :DĪdd this batch script to your scheduler (at logon and at 20:01) and you will have automagic wallpaper changer based on the time of the off The problem was it sometimes did work at 1st attempt, sometimes after 5th attempt. If past - sets night wallpaper if before - sets day wallpaper. It checks if it is before or after 20:00 o'clock. Rundll32.exe twice that was really slowing me down. I was looking for a simple swap and refresh and it was knowing the location and that I needed to run the Of course Cloud_TS has shown a good PowerShell Function to set that to whatever you want, which could be reshaped to centralise the WallPaper across multiple users or groups of users. Get-ItemProperty -path 'HKCU:\Control Panel\Desktop' | Select -Property WallPaper Then you can find out the path and file name with:

What to check for though is the users "Themes" folder listed above encase it is named differently or you are using BMP files. I was doing this with Powershell to automate a testbox setup after a Clone\Replication job. User32.dll, UpdatePerUserSystemParameters If you just want to change a single image rather that updating the registry, then for a 2008 R2 box you need to replace this file:Ĭ:\users\\AppData\Roaming\Microsoft\Windows\Themes\TrancodedWallpaper.jpgĪnd then for some reason I needed to run this command twice: These answers are right, but didn't work too smoothly for me on a 2008 R2 server. This can be beneficial to other community members reading the thread. Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. If you need some help on writing this script, you can also post your question to The Official Scripting Guys Forum: If you are interested, I would like to share the following article with you for your reference: Set-WallPaper -value " the path of you wallpaper" Now, if you want to change some wallpaper, you could type the following text: Open PowerShell paste the function above in it to make this function work. Rundll32.exe user32.dll, UpdatePerUserSystemParameters Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $value We could create a function to set wallpaper: I think this can be done with PowerShell.
