VBS fails but PDAT says success

Topics: Archive - General
Apr 9, 2014 at 1:22 AM
Hi,

doing an install of Project via VBS.
#*===============================================
#* INSTALLATION 
$installPhase = "Installation"
#*===============================================

    # Perform installation tasks here
    Show-BalloonTip -BalloonTipText "Installation of $($appName) started. Please be patient." -BalloonTipTitle "$($appName)"
    Execute-Process -FilePath "cscript.exe" -Arguments "`"$dirfiles\Install_Microsoft_Office_Project_Standard_2007_12.00.4501.vbs`"" -WindowStyle Hidden
    
The vbs fails with:
08-04-2014 15:15:29] [Installation] Executing [cscript.exe "C:\Windows\ccmcache\2t\Files\Install_Microsoft_Office_Project_Standard_2007_12.00.4501.vbs"]...
[08-04-2014 15:15:29] [Installation] Working Directory is []
[08-04-2014 15:15:30] [Installation] C:\Windows\ccmcache\2t\Files\Install_Microsoft_Office_Project_Standard_2007_12.00.4501.vbs(18, 4) Microsoft VBScript runtime error: Path not found


[08-04-2014 15:15:30] [Installation] Execution completed with return code 0.
Already tried the PassThru parameter of Execute-Process, doesn't change anything.
Problem is, although the install failed, PDAT tells the user that the installation was successful.

Is CSCRIPT.EXE not passing the exit code correctly?

Thanks
David
Apr 9, 2014 at 9:50 AM
Edited Apr 9, 2014 at 9:55 AM
Hi David,

did you think that this one is right.
"`"$dirfiles\Install_Microsoft_Office_Project_Standard_2007_12.00.4501.vbs`""
On the Beginning you set "`" on the End of Line you set`"". i think the right is`""
""`$dirfiles\Install_Microsoft_Office_Project_Standard_2007_12.00.4501.vbs`""
with best regards
André
Coordinator
Apr 9, 2014 at 8:47 PM
Edited Apr 9, 2014 at 8:47 PM
Hi David,

I've been able to reproduce this using a buggy VBScript and I don't think it's something specific to the PADT. If you run the VBScript in a command prompt and then type echo %errorlevel% you should also see a 0 return code.

You will probably need to put some error handling in to the VBScript and throw a different error code if you catch an error.

Cheers,

Sean

PS. @André, David's quotes are correct, the back ticks are escape characters in PowerShell.
Apr 9, 2014 at 11:22 PM
Thanks Sean, thought as much. Crappy legacy stuff... ;)

Again, awesome work you did here!!!
Apr 10, 2014 at 7:52 PM
PowerSheller wrote:
PS. @André, David's quotes are correct, the back ticks are escape characters in PowerShell.
Thanks for your clue, i am a beginner in Powershell and i am learning a lot of it.
Your script is awesome and great work. ;)