v3.6.8 Uninstall section not running office 2016 clean up script


I’m having an issue with PSAppdeploytoolkit v3.6.8 uninstall section.
I’ve created a PSAD wrapper for installing Office 2016 from MSI.
I have included the OffScrub_O15msi.vbs and OffScrub_016msi.vbs scripts in the supportfiles folder.
It installs Office successfully and is running the OffScrub_015msi.vbs and removing Office 2013 before it installs Office 2016.

However when I launch Deploy-Application.exe uninstall it claims to run the script successfully but nothing is removed. If I manually run the OffScrub_016msi.vbs with the same options it does remove Office successfully.

This is the uninstall section of my Deploy-Application.ps1 file.

##*=============================================== ##* UNINSTALLATION ##*=============================================== [string]$installPhase = 'Uninstallation'
	## Handle Zero-Config MSI Uninstallations
	If ($useDefaultMsi) {
		[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Uninstall'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
		Execute-MSI @ExecuteDefaultMSISplat
	# <Perform Uninstallation tasks here>
	Show-InstallationWelcome -CloseApps "excel,groove,onenote,infopath,outlook,mspub,powerpnt,winword,winproj,visio" -CloseAppsCountdown "60"

    # Show Progress Message (with the default message)

    # Uninstall Office 2016
    ForEach ($officeExecutable in $officeExecutables) {
	    If (Test-Path (Join-Path $dirOffice "Office16\$officeExecutable")) { 
		    Write-Log "Microsoft Office 2016 was detected. Will be uninstalled."
		    Execute-Process -FilePath "CScript.Exe" -Arguments "<code>&quot;$dirSupportFiles\OffScrub_O16msi.vbs</code>" ClientAll /S /Q /NoCancel" -WindowStyle Hidden -IgnoreExitCodes "1,2,3"

	[string]$installPhase = 'Post-Uninstallation'
	## &lt;Perform Post-Uninstallation tasks here&gt;


Any help much appreciated as I’m going a little crazy looking at this.

See below from the log file which says the exit code from OffScrub_016msi.vbs is 0.

[Initialization] :: Session 0 not detected. PSAppDeployToolkit 15/06/2016 14:43:44 5240 (0x1478) [Initialization] :: Installation is running in [Interactive] mode. PSAppDeployToolkit 15/06/2016 14:43:44 5240 (0x1478) [Initialization] :: Deployment type is [Uninstallation]. PSAppDeployToolkit 15/06/2016 14:43:44 5240 (0x1478) [Pre-Uninstallation] :: Display balloon tip notification with message [Uninstallation started.]. Show-BalloonTip 15/06/2016 14:43:44 5240 (0x1478) [Pre-Uninstallation] :: Spin up progress dialog in a separate thread with message: [Uninstallation in progress. Please wait...]. Show-InstallationProgress 15/06/2016 14:43:44 5240 (0x1478) [Uninstallation] :: Check for running application(s) [excel,groove,onenote,infopath,outlook,mspub,powerpnt,winword,winproj,visio]... Get-RunningProcesses 15/06/2016 14:43:45 5240 (0x1478) [Uninstallation] :: Application(s) are not running. Get-RunningProcesses 15/06/2016 14:43:45 5240 (0x1478) [Uninstallation] :: Finished checking running application(s). Get-RunningProcesses 15/06/2016 14:43:45 5240 (0x1478) [Uninstallation] :: Update progress message: [Uninstallation in progress. Please wait...]. Show-InstallationProgress 15/06/2016 14:43:46 5240 (0x1478) [Post-Uninstallation] :: Close the installation progress dialog. Close-InstallationProgress 15/06/2016 14:43:47 5240 (0x1478) [Post-Uninstallation] :: Microsoft_Office_2016_x86_EN_01 Uninstallation completed with exit code [0]. Exit-Script 15/06/2016 14:43:47 5240 (0x1478) [Post-Uninstallation] :: Display balloon tip notification asyhchronously with message [Uninstallation complete.]. Show-BalloonTip 15/06/2016 14:43:47 5240 (0x1478) [Post-Uninstallation] :: [C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe] is a valid fully qualified path, continue. Execute-Process 15/06/2016 14:43:47 5240 (0x1478) [Post-Uninstallation] :: Working Directory is [C:\windows\System32\WindowsPowerShell\v1.0]. Execute-Process 15/06/2016 14:43:47 5240 (0x1478) [Post-Uninstallation] :: Executing [C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe [PowerShell ScriptBlock]]... Execute-Process 15/06/2016 14:43:47 5240 (0x1478) [Post-Uninstallation] :: NoWait parameter specified. Continuing without waiting for exit code... Execute-Process 15/06/2016 14:43:47 5240 (0x1478) [Post-Uninstallation] :: ------------------------------------------------------------------------------- Exit-Script 15/06/2016 14:43:47 5240 (0x1478)

hmmm still can’t make it work as I think it should, I’ve tried downloading a new copy of the toolkit as somebody else suggested in another thread with a similar but not the same unistall issue but that didn’t work.

However I’ve found a workaround for it.
If I execute a CMD process it can call the VB OffScrub script ok.

Execute-Process -FilePath "CMD.Exe" -Arguments "/c cscript.exe "$dirSupportFiles\OffScrub_O16msi.vbs" ClientAll /S /Q /NoCancel" -WindowStyle Hidden -IgnoreExitCodes "1,2,3"

I’d love to know why the toolkit can’t execute the cscript.exe process correctly during uninstall but works fine during preinstall section. But at least it’s working with the CMD.exe process calling cscript.