Need help making this script true. i beleave the first part is done file, but registry needs to be reflected from information 4-8 thank you.
1 \'this vbscript should
This VBScript for:
1-Run script as administrator
2-Copy my image to the directory where the background image saved
3-Change the current desk background image to my image From registry
4-Force Log off the current user to apply the change
'run the script as Administrator
If WScript.Arguments.Length=0 Then
CreateObject("Shell.Application").ShellExecute "wscript.exe",Chr(34)&WScript.ScriptFullName&Chr(34)&" Admin",Null,"runas",1
WScript.Quit
End If
'copy the image from to
Dim WShellObj : Set WShellObj=createobject("WScript.Shell")
Dim filesys : set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(WShellObj.ExpandEnvironmentStrings("%cd%")&"\cat.jpg") Then
WShellObj.Run "cmd.exe /c copy ""%cd%\cat.jpg"" %windir%\web\wallpaper\windows",0,False
End If
'change desktop wallpaper through registry
WShellObj.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper","%WINDIR%\Web\Wallpaper\Windows\cat.jpg","REG_SZ"
'force log off to apply the change of wallpaper
Dim oSystem
For Each oSystem In GetObject ("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem")
oSystem.Win32Shutdown 4
Next
Try this one from spicework forum:
reg.exe load HKU\DefUser "C:\Documents and Settings\Default User\ntuser.dat"
reg.exe add "HKU\DefUser\Control Panel\Desktop" /v Wallpaper /d "c:\windows\wallpaper\desktop.bmp" /f
reg.exe unload HKU\DefUser
The link is here: http://community.spiceworks.com/scripts/show/327-batch-file-to-set-the-default-wallpaper