Close Menu
    Facebook X (Twitter) Instagram
    Monday, June 23
    X (Twitter) LinkedIn
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»Scripting»VB Script to change the desktop wallpaper

    VB Script to change the desktop wallpaper

    Eswar KonetiBy Eswar KonetiJune 23, 9:07 pm1 Min Read Scripting 22,623 Views
    Share
    Facebook Twitter LinkedIn Reddit

    Below is the script to change your desktop wallpaper. You just need to modify the script to point to the location where the 'wallpaper is located.

    You can then include this script in your Domain's Group Policy's login or startup script.

     

    ' ----------------------------Script to change Desktop Wallpaper-----------------------------------------

    dim wshShell
    dim sUserName

    Set wshShell = WScript.CreateObject("WScript.Shell")
    sUserName = wshShell.ExpandEnvironmentStrings("%USERNAME%")

    Set oShell = CreateObject("WScript.Shell")
    Set oFSO = CreateObject("Scripting.FileSystemObject")

    sWinDir = oFSO.GetSpecialFolder(0)
    sWallPaper = "C:\Users\eskonr\Pictures\Nice-Windows-7.jpg"

    ' update in registry
    oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper

    ' let the system know about the change
    oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True

    msgbox "done"

     

    You will have to change the bold letter (image file) with your image file path.

    Change Desktop Wallpaper Geek Desktop Wallpaper How to cheat GPO Wallpaper VB Script to change the desktop wall paper
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    Application Deployment with Hybrid Joined Requirement Rules in Intune

    October 06, 8:59 pm

    Troubleshooting Windows KMS Activation Issues with SCCM scripts feature

    September 09, 11:07 pm

    Migrating Windows Update Workloads from SCCM to Intune: How to Verify Management Tool

    August 23, 9:55 pm

    5 Comments

    1. Ryan L on September 2, 2018 10:18 AM

      When I run it the first time it changes, but when I run it a second time with a different wallpaper, it doesn't change. Also, when you do it, you have to restart Explorer.

      Reply
      • Eswar Koneti on September 2, 2018 6:34 PM

        Hi Ryan,
        why dont you use group policy to change wallpaper and is most recommended way and it works all time.

        Thanks,
        Eswar

        Reply
        • Mike D DeArmond on October 1, 2019 9:36 PM

          Because 95% of the environments I manage are NOT a domain environment.

          Reply
    2. Tanclone C on April 8, 2017 7:39 AM

      just changes the background to black

      Reply
      • Eswar Koneti on April 13, 2017 3:12 PM

        can you check the registry for wallpaper patch in HKEY_CURRENT_USER\Control Panel\Desktop\?is it set correctly ?

        Regards,
        Eswar

        Reply

    Leave a ReplyCancel reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

    © Copyright 2009-2024 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.