I was given a challenge to solve for making a little fun in the office. So I've tried to setup a VM lab with a windows server 2012 R2 & client Windows 10 to test this on.
The challenge I am facing:
Windows 10 is not always refreshing wallpaper when set, using the command by using the psexec:
rundll32.exe user32.dll, UpdatePerUserSystemParameters, 1, true
This seems to be due to a limitation in rundll32.exe or user32.dll not sure why.
I instead have to use a new theme that I have created by copy that to the client and load it with psexec to present it to the user instantly without logoff or restart. Although sometimes it does just not work or it simply just make the background black, like it's removing the wallpaper completely when I run the script more times to ensure that it works even though how many times I run it. Keep in mind this script is dependent on the client is online by that means that the DNS is working proper and you can also ping the host.
How can I ensure that the wallpaper is always being refreshed and working? - and is there a better method of this you can find, then kindly let me know because I tried to search on the internet but could not find anything working as good as this I've made so far on Windows 10 through powershell.
The script I currently got working right now is the following:
Download the source code here:
- save this as ChangeDesktopBackgroundRemotely.ps1 -- Main script you run
- save this as newtheme.theme in "C:\tmp" on your server
- save this as refreshbg.ps1 in "C:\tmp" on your server
- save FCK.jpg as FCK.jpg in "C:\tmp" on your server
- save aalborg.jpg as aalborg.jpg in "C:\tmp" on your server