Jump to content


  • 0
Canada Jack

Set background picture in SCCM Windows 7 32bit image, but failed

Question

I just want set up an image as background. So create one package that includes one vb script and one jpg files. I put this in the last step in TS. After the SCCM process was complete, but the background didnt change. I check c drive, the jpg is copy to correct location, but nothing change in registry. When I test this script by manually, its works. Its seem once SCCM is complete, it did some cleanup process. This is my script.

 

 

Option Explicit

 

 

 

'******************************************* Declarations

Dim wshShell,wshNetwork,fileSys,objRegistry,oProcEnv,oSystem,oBios,objServ,oHardware

Set wshShell = WScript.CreateObject("WScript.Shell")

Set wshNetwork = CreateObject("WScript.Network")

Set fileSys = CreateObject("Scripting.FileSystemObject")

 

'Set the error count to 0

nErrorcount = 0

 

WshShell.Run "reg load ""HKU\Default User"" ""c:\Users\Default\ntuser.dat""",2,True

 

 

'Change Desktop Wallpaper

fileSys.CopyFile currentdir & "att.JPG", "c:\windows\web\wallpaper\"

 

WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper","c:\windows\web\wallpaper\att.JPG","REG_SZ"

WshShell.RegWrite "HKEY_USERS\Default User\Control Panel\Desktop\Wallpaper","C:\WINDOWS\web\wallpaper\att.JPG","REG_SZ"

WshShell.RegWrite "HKEY_USERS\.Default\Control Panel\Desktop\Wallpaper","C:\WINDOWS\web\wallpaper\att.JPG","REG_SZ"

 

 

WshShell.RegWrite "HKCU\Control Panel\Desktop\WallpaperStyle","0","REG_SZ"

WshShell.RegWrite "HKEY_USERS\Default User\Control Panel\Desktop\WallpaperStyle","0","REG_SZ"

WshShell.RegWrite "HKEY_USERS\.Default\Control Panel\Desktop\WallpaperStyle","0","REG_SZ"

 

 

WshShell.Run "reg unload ""HKU\Default User""",2,True

 

 

Wscript.Quit nErrorCount

 

 

 

 

 

Please give some idea, thanks.

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

I use the below script to set the desktop wallpaper:

 

'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.

 

'-----------------------------------------

 

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\100_4260.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"

 

 

 

Share this post


Link to post
Share on other sites

  • 0

I use the below script to set the desktop wallpaper:

 

'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.

 

'-----------------------------------------

 

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\100_4260.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"

 

 

Thanks Eswar, but I put your script in TS, still doesn't works. I mean, put this script in Domain's Group Policy's login or startup script, it will works. But I just want figure out why the registry setting doesn't works.

Share this post


Link to post
Share on other sites

  • 0

Now I found the issue is: The script only works for current user. But if I create a new user, it will not works. In other words, it doesn't apply for deftalut user.

 

Why?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.