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\Win7\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
Capt.Jack Sparrow

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

Similar help and support threads
Thread Forum
Burnt out from error error error! Time to go back to Paper.
Hello there. I have been redirected here by jamanji, whom has been most helpful by the way. My PC crashed a little over a week ago. Rather than retype everything, I would like to give you the link to my post. I am not 'Tech' per se, but I would like to try and resolve my problem myself, To...
System Security
Error 41, Error 1001 and error 6008.
Hello there. Recently my computer have just randomly shutdown meanwhile i'm playing games like CS;GO, League of Legends. The screen will just turn black and it will start to make one hell of annoying noise untill it reboots. I've updated all my drivers. Tested my memory. Tested my RAM. Run a...
BSOD Help and Support
Error copying file: Data error (cyclic redundancy check). CRC Scan ?
Edit: Think my hard drive may be failing and was the cause of my file synchronizing crash. I use it mostly to stream music and video and access the hard drive a lot. Any advice thanks HDDStatus - Tool to check hard disk status, health and reliability Hey, I've been using GoodSync for the...
Backup and Restore
BSOD by ntoskrnl.exe, error d1, error 3b, error 1a
I've just install windows 7 home premium 64bit and got 4 times of BSOD. for the first time error code is 0x0000001a for the 2nd time error code is 0x0000003b for the 3rd time error code is 0x0000003b for the 4th time error code is 0x000000d1 I also attach minidump files and text files that...
BSOD Help and Support
Scan Error Error while Scan::0::LEAD Error: Twain source manager no
hi.... i have promblme , i do not know how to fix it.. i have kodak scnners i1220 plus i have RD Web Access the promblme is.. I have a system based on Oracle has been connted with one scanners( i connected with scanners) When i do a scan shows me this a message (Scan Error Error while...
Hardware & Devices

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 16:56.
Twitter Facebook Google+