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