Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: VBS error

04 May 2010   #1

Windows 7 Enterprise
VBS error

Hi guys, I hope Im putting this in the right place...
I've got a script that I'll be including to my pre-sysprep scripts...
Basically, I need it to change the folder permissions on the \oobe\info\backgrounds\ folder so I can copy out company image there. Custom logon background...

However, im getting a funky error message:
Script: W:\exists.vbs
Line: 27
Char: 1
Error: Permission denied
Code: 800A0046
Source: Microsoft VBScript Runtime error
My Script is:
strFolderInfo = "C:\windows\system32\oobe\info\backgrounds"
strImageFile = "W:\images\Windows 7\files\images\background.jpg"
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set mySHL = CreateObject("WScript.Shell")
if not myFSO.FolderExists(strFolderInfo) then
 WScript.Echo("Create Info Folder")
 WScript.Echo("Folder already Exists")
end if
intRunError = mySHL.Run("%COMSPEC% /c Echo Y| cacls " & strFolderInfo & " /t /c /g Everyone:F ", 2, True)
   If intRunError <> 0 Then
   Wscript.Echo "Error assigning permissions for " & strHomeFolder
   End If
intRunError2 = mySHL.Run("%COMSPEC% /c Echo Y| attrib -R " & strFolderInfo,2,TRUE)
   If intRunError2 <> 0 Then
   Wscript.Echo "Error Applying Attributes "  & strUser & " to home folder " & strFolderInfo 
   End If
<line 27>  intCopyError = myFSO.CopyFile(strImageFile, strFolderInfo, True)
   If intCopyError <> 0 Then
 WScript.Echo("Error: " & intCopyError)
 WScript.Echo("Background Image Copied.")
   End If
I know the actual image is meant to be named BackgroundDefault.jpg, but this is for testing at the moment...
Also, the <line 27> is not in the script, its just for your quick reference.
W:\ is a mapped network share

Can someone point me in the right direction as to why this is not working as expected?

My System SpecsSystem Spec

04 May 2010   #2

Windows 7 Ultimate - 64-bit | Windows 8 Pro - 64-bit

Hello !!

I'm not a programer but according to error seems like the permission is denied to that location. I guess try to disable your UAC then try to run the script again. Also Take Ownership of the location "C:\windows\system32\oobe\info\backgrounds" Maybe the whole System32 folder.

Hope this helps,
My System SpecsSystem Spec
04 May 2010   #3

Windows 7 Enterprise

Thanks Capt'n.
UAC is always off.
intRunError = mySHL.Run("%COMSPEC% /c Echo Y| takeown.exe /F " & strFolderInfo, 2, True)
   If intRunError <> 0 Then
   Wscript.Echo "Error assigning permissions for " & strFolderInfo
   End If
to take ownership.
However I still got the error.


After coming back from lunch with a clear calm head, suffixing a slash to the end of the strFolderInfo path made it work!

Looks like we cant copy file1 into file2, unless you specify that file2 is actually a folder.
My System SpecsSystem Spec

19 May 2010   #4


Hi Xarden,
I have the same problem here. Can you please post your cod?
Best regards,
My System SpecsSystem Spec
19 May 2010   #5

Windows 7 Enterprise

Two parts attached.
You'l need to edit the vbs file and change the strImageFile path to whatever your image is.

Read my other post here before you do it.
My System SpecsSystem Spec

 VBS error

Thread Tools

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 03:04 AM.
Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33