?
Solved

Windows Script Host \ VBScript Error \ 800704C8

Posted on 2009-07-06
4
Medium Priority
?
2,165 Views
Last Modified: 2012-05-07
Attached is a script that copies Microsoft Office templates from a server share to a user's computer when they log in.  It is a VB Script that is run during logon via Group Policy.  I am starting to hear reports of user's getting an error message that says:
"The requested operation cannot be performed on a file with a user-mapped section open" (screenshot attached) and mentions line 35, error code 800704C8.

I was able to reproduce the problem once on my laptop, could this possibly be due to roaming profiles and being logged in to two separate PCs at once?

Please let me know if i left out any other important information on my environment and thanks as always!
Option Explicit
 
dim TemplatePath
dim ExcelPath
 
TemplatePath = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%") & ("\Application Data\Microsoft\Templates")
ExcelPath    = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%") & ("\Application Data\Microsoft\Excel\XLSTART")
 
dim objFSO
set objFSO = CreateObject("Scripting.FileSystemObject")
 
CheckAndCreateFolders(TemplatePath)
CheckAndCreateFolders(ExcelPath)
 
Sub CheckAndCreateFolders(sPath)
    Dim arrPath
    Dim strPath
    Dim n
    arrPath = split(sPath,"\")
    for n = LBound(arrPath) to UBound(arrPath)
        if n = LBound(arrPath) then
            strPath = arrPath(n)
        else
            strPath = strPath & "\" & arrPath(n)
        end if
        If Not objFSO.FolderExists(strPath) Then
            'msgbox strPath
            objFSO.CreateFolder strPath
        End If
    next
End Sub
 
Const OverwriteExisting = True
 
objFSO.CopyFile "\\serverpdc\public\Office Management\Corporate Identity & Art Work\Office 2007 Templates\*", TemplatePath & "\", OverwriteExisting
objFSO.CopyFile "\\serverpdc\public\Office Management\Corporate Identity & Art Work\Office 2007 Templates\Excel\*", ExcelPath & "\", OverwriteExisting

Open in new window

6-26-2009-11-54-12-AM.png
0
Comment
Question by:zeotech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 25

Expert Comment

by:Ron Malmstead
ID: 24789092
That basically means the file is "locked" or in-use.  Probably does have something to do with Roaming profile.

Does it only happen when logged on to two different machines ?
0
 
LVL 6

Author Comment

by:zeotech
ID: 24789155
I just tried executing the script manually from a laptop while logged in to the desktop as well and I did not receive the error message.
0
 
LVL 25

Expert Comment

by:Ron Malmstead
ID: 24789201
Try putting in some sleep time before the actual copy operation...

Maybe the profile is still loading after the logon while that file is being copied...
0
 
LVL 5

Accepted Solution

by:
boowhup earned 1500 total points
ID: 24789232
On the server it's sitting on, check if anyone has it "open" Computer Managment - Shared Folders - Open Files. It sounds like someone is oopening the source file directly.

Or it may be "contention" - everyone logs in at the same time, and there could be too many people trying to copy it at once. Maybe you could add some conditional statements to your script that check the file is newer on the server than your local one before ti copies it.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question