Error while trying to copy file via VBS

Asked

Viewed 25 times

0

I am creating a Script to change the wallpaper via VBS where I copy an image from the server and put on the user’s computer, I have tried to change using GPO but some Windows 10 computers are not changing so I am looking for other alternatives.
Copying image shows error: 800A004C - Path not found
Both paths I put are correct but the error continues, follows code:

'1 – Criar a pasta, subpasta e copiar o wallpaper para o computador local.

'On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder("C:\MeuSistema\")
Set objFolder = objFSO.CreateFolder("C:\MeuSistema\Wallpaper\")

Set objSh = CreateObject("Wscript.Shell")
strWallpaperPath = "\\SERVIDOR\Plano de Fundo - Desktop\02C_Carnaval.jpg"
strLocal = "C:\MeuSistema\Wallpaper"

objFSO.CopyFile strWallpaperPath, strLocal, True



'2 – define o wallpaper como padrão

sWallPaper = "C:\MeuSistema\Wallpaper\02C_Carnaval.jpg"

objSh.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
objSh.Regwrite "HKCU\Software\Microsoft\Internet Explorer\Desktop\General\Wallpaper", sWallPaper
objSh.Regwrite "HKCU\Software\Microsoft\Internet Explorer\Desktop\General\BackupWallpaper", sWallPaper
objSh.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.