How to check if a specific file exist and which exit code to use ?

How to check if a specific file exist and which exit code to use ?

Hi, First I'm not a scripting guy and I know almost nothing about VB scripting.

I have a deployment of 6 tasks and I want to make sure that step # 2 will not be process if it failed in step #1, and so on for the 6 task.

To do this, i have to run a vbs script before installation or uninstalltion on each steps

I'm trying to use the script form ME support page  that i have modified for pre-uninstallation of software and also post-installation of the software.

Pre-uninstallation: The script will look if the specified "exe" exist on the server and if so, than it will run the msiuninstall "application_name".

If the uninstallation is successful, the post-installation script will check if the "exe" file exist again on the server, and it shouldn't find it (because it was deleted from the uninstallation), than it will return an exit code of successful to run the next process.

Here an example:

Step 1: Uninstall "Software#1" with msiuninstall Software#1.exe command

Step 2: Uninstall "Software#2" with msiuninstall Software#2.exe command

Step 3: Install "Software #3"with an .exe extension

Step 4: Re install "Software #2" with an .msi extension

Step 5: Re install "Software #1" with a .msi extension.

Step 6: Send email to confirm the deployment is successful

So i need to validate that step #2 will not process step #3 if it failled on # 2. It need to validate if the file exist before and after.

At the end, Step 6 should send an email to confirm that the 6 steps of the deployment was completed without errors.

Any idea how to do it ?

Many many thanks for all the help !

A desperate guy :)

This is what i have

'This script will look if an .exe file exist for a specific application.
'=============================================================================================

path = WScript.Arguments.Item(0)
set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists(C:\Inetpub\wwwroot\Enterprise\EnterpriseWS\web.config) = true then

    exitCode = 0
else
    exitCode = 1
End If
    
Wscript.Quit exitCode












                New to ADSelfService Plus?