Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deploying executables

Status
Not open for further replies.

pmidwest

Programmer
Jan 9, 2002
162
US
Ok so this is probably not the right place to ask about this but I’ll give it a shot.
I’ve created a batch script that copies an executable file to multiple servers. It looks something like this.

“cls
echo Installing TimeCard!
echo.
echo Please wait...
echo.
echo Trying to overwrite files on Boris.
echo.
:BorTimeFail
copy \\Magilla\vha\Updates\WinPIMS\pjtTimeCard.exe \\Boris\e$\VHA\TimeCard\ >NUL
IF ERRORLEVEL == 1 GOTO BorTimeFail
echo."

(Code above repeated 10 times with different server names.)

"cls
echo Success!
echo.
echo TimeCard has been installed on all servers.
echo.
Pause”

The problem I’m having is that if the file is in use on the first server it continues to loop until it copies successfully. Is there anyway for me to make this script a bit more advanced? Say using VBScript to remember what servers error out and after its done each server go back and retry the ones that failed?

Thanks in advance!

P.
 
This method would basically loop until all copies are completed. It might need some tweaking (I didn't test it), but should point you in the right direction.

Code:
Const OverWrite = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim sFileFrom(10)
Dim sFileTo(10)
Dim bCopySuccess(10)

sFileFrom(1) = "\\Magilla\vha\Updates\WinPIMS\pjtTimeCard.exe"
sFileFrom(2) = NextFile
sFileFrom(3) = AndSoOn

sFileTo(1) = "\\Boris\e$\VHA\TimeCard\"
sFileTo(2) = NextLocation
sFileTo(3) = AndSoOn

bCopyIncomplete = True
While bCopyIncomplete
    bCopyIncomplete = False
    For i = 1 to 10
        If bCopySuccess(i) = False Then
            On Error Resume Next
            objFSO.CopyFile sFileFrom(i), sFileTo(i), OverWrite
            If Err.Number Then
                bCopyIncomplete = True
            Else
                bCopySuccess(i) = True
            End If
        End If
    Next
Wend
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top