Win7 desktop wallpaper not refreshing after setting in login .VBS

Posted on 2009-12-17
Last Modified: 2012-05-08
I'm working on a new login script (.vbs) for our Windows 7 stations, and one line item is to set the desktop wallpaper.

I can seccessfully set the registry key (HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper) to the desired file. I can verify this by checking in the registry itself, and it is also correctly identified as the current background when right-clicking on the desktop and selecting "Personalize". However, the new wallpaper setting is not actually applied to the desktop.

I added a next line in the login script to try and force an update (i.e. using rundll.exe user32.dll, but that does not seem to apply the background, either. Even if I try and run the rundll.exe command manually from the command prompt, nothing changes...

I am currently logged in with an account that is in the local admin group, so I wouldn't think it's a permissions thing, but since it's not working, I have no clue. I also saw a few places online talking about needing to make sure it is a specific file format, so I've tried .png, .jpg, and .bmp, all to no avail. Is there something different I need to be doing on Win7?
Question by:pillbug22
    LVL 6

    Author Comment

    Is the rundll32.exe user32.dll potentially only allowed to run after a certain time interval has passed?

    I'd been trying all morning with no success, but after going to lunch, coming back, and trying, the script worked as expected and updated the desktop. I immediatly tried again (manually changed the wallpaper to something else, then re-ran the script), but it did not change.

    I'll let it sit for a while again and see what happens.
    LVL 6

    Author Comment

    OK, just over an hour later, and the script works again. Seems to be time-related. Guess I'll start cutting down on the time inbetween running it and see what the magic number seems to be.
    LVL 6

    Accepted Solution

    I've been able to re-run the script about once every 5 minutes, which I beieve should be sufficient for what we're doing...

    Guess there is a time limit on the rundll32.exe. At least now I know!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    This script will sweep a range of IP addresses (class c only, and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
    If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
    This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
    This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now