Changing desktop wallpaper and changing the the background color

الإجابة Changing desktop wallpaper and changing the the background color

  • Thursday, December 06, 2012 7:02 PM
     
     

    Hello scripting gurus,

    I have my company logo and have a VBscript that change the wallpaper to the company logo.

    The problem is that the company logo stretches all over the screen and I would like to keep it in the center.

    The script is:

    dim wshShell
    dim sUserName

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

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

    sWindDir = oFSO.GetSpecialFOlder(0)
    sWallPaper = "c:\companylogo.jpg"

    oShell.RegWrite "HKCU\Control Panel\Desktop\wallpaper", sWallPaper

    oShell.Run "%windir%\System32\RunDLL32.exe user32.dll,UpdatePerUserSystemParameters", 1, True

    Is there any option I have to add to the script to make the logo in the center and the background color blue?

    Thank you,

    Morris

All Replies

  • Thursday, December 06, 2012 7:09 PM
    Moderator
     
     Proposed

    Why not just configure the settings you want in a GPO?

    Bill

  • Thursday, December 06, 2012 7:31 PM
     
     

    Well, if it was a GPO question I would do it through a GPO.

    I'm looking for the VB script

    Morris

  • Thursday, December 06, 2012 8:22 PM
     
     

    Well, if it was a GPO question I would do it through a GPO.

    I'm looking for the VB script

    Morris

    You need to set the  key to not tile the paper (TileWallPaper=0) and to not stretch the paper (WallpaperStyle=0).

    This would be easier done through a REG file.  Just export the key from a system that has been set manually and then run the exported file.


    ¯\_(ツ)_/¯


  • Thursday, December 06, 2012 8:34 PM
    Moderator
     
     
    Well, if it was a GPO question I would do it through a GPO.

    Why don't you want to do it through a GPO?

    Bill

  • Thursday, December 06, 2012 8:54 PM
     
      Has Code

    Here is the REG file to set this in one simple shot.

    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Control Panel\Desktop]
    "TileWallpaper"="0"
    "Wallpaper"="c:\windows\mypaper.jpg"
    "WallpaperStyle"="0"

    Place in file with REG extension then double click or run as batch:

    REG IMPORT c:\scripts\WallPaper.reg


    ¯\_(ツ)_/¯

  • Thursday, January 17, 2013 7:20 PM
     
     Answered

    Guys,

    I got the solution through a customized GPO.

    Thanks,

    Morris

    • Marked As Answer by Morris - MS Thursday, January 17, 2013 7:20 PM
    •  
  • Thursday, January 17, 2013 7:23 PM
     
     

    Guys,

    I got the solution through a customized GPO.

    Thanks,

    Morris


    You should not mark your response as an answer.  The answer was given to you by Bill.

    ¯\_(ツ)_/¯