Forum Discussion

SjoerdVW's avatar
SjoerdVW
Copper Contributor
Nov 07, 2019

Desktop Background Image by script

We have an startup script running picks a random image from a pool and places it in %programfiles%\mycompany\dekstop.jpg

 

During logon we change the users desktop, poiting to this image.

 

However: The user doesnt see this image, but an other one.

 

The strange thing is: when the user wants to change the desktop image, in the preview window the correct image is shown.

Also, running "RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1" will fix the desktop imidiatly.

I added this in the login script, but that doesn't seems to have any effect.

 

2 Replies

  • Ulisesin's avatar
    Ulisesin
    Iron Contributor

    The script might be changing the desktop background, but Windows hasn't finished applying the change when you run the update command. Try adding a short delay (like a few seconds) before running the update command to give Windows time to apply the new setting.

  • Run the image‐set in a User Logon script, not a Computer Startup script

    Set HKCU\Control Panel\Desktop\Wallpaper to "%ProgramFiles%\mycompany\desktop.jpg"

    Call:

    RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1,True


    If Logon scripts still fire too early, place the above call in
    HKCU\Software\Microsoft\Windows\CurrentVersion\Run

    Or deploy via GPO:
    User Configuration → Administrative Templates → Desktop → Desktop Wallpaper

Resources