Uninstall all version of Office

Hi Guys

Im trying to uninstall all versions of Office before I install Office 2024 and im trying to use SaRACmd command using the pre-installation task.

Execute-Process -Path "$dirFiles\SaRACmd_17_01_2276_000\SaRACmd.exe" -Parameters '-S OfficeScrubScenario -AcceptEula -OfficeVersion All'
I’m getting the error below and I can’t figure out why. Any help will be appreciated.

[Pre-Installation] :: Executing [C:\Users\aCCCCCC\Desktop\PSAppDeployToolkit_Office2024\Toolkit\Files\SaRACmd_17_01_2276_000\SaRACmd.exe -S OfficeScrubScenario -AcceptEula -OfficeVersion All]… 10/22/2024 7:39:54 AM 10524 (0x291C)
[Pre-Installation] :: Execution failed with exit code [1]. 10/22/2024 7:40:13 AM 10524 (0x291C)
[Pre-Installation] :: Closing the installation progress dialog. 10/22/2024 7:40:13 AM 10524 (0x291C)
[Pre-Installation] :: Closing the installation progress dialog’s runspace. 10/22/2024 7:40:13 AM 10524 (0x291C)
[Pre-Installation] :: Office2024ProfessionalPlus_EN_01 Installation completed with exit code [1]. 10/22/2024 7:40:13 AM 10524 (0x291C)
[Pre-Installation] :: Check if PowerPoint is in either fullscreen slideshow mode or presentation mode… 10/22/2024 7:40:14 AM 10524 (0x291C)
[Pre-Installation] :: PowerPoint application is not running. 10/22/2024 7:40:14 AM 10524 (0x291C)
[Pre-Installation] :: PowerPoint is running in fullscreen mode [False]. 10/22/2024 7:40:14 AM 10524 (0x291C)
[Pre-Installation] :: Display balloon tip notification asynchronously with message [Installation failed.]. 10/22/2024 7:40:14 AM 10524 (0x291C)
[Pre-Installation] :: [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe] is a valid fully qualified path, continue. 10/22/2024 7:40:14 AM 10524 (0x291C)
[Pre-Installation] :: Working Directory is [C:\Windows\System32\WindowsPowerShell\v1.0]. 10/22/2024 7:40:14 AM 10524 (0x291C)
[Pre-Installation] :: Executing [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe [PowerShell ScriptBlock]]… 10/22/2024 7:40:14 AM 10524 (0x291C)
[Pre-Installation] :: NoWait parameter specified. Continuing without waiting for exit code… 10/22/2024 7:40:14 AM 10524 (0x291C)

Maybe make SARA create a log file with the Enterprise version

Seems the error only happens if I try to uninstall Office 2021 but works with the other offices… Weird… So what I tried is to run the below command… Is there a way to run both it seems to fail on continueonerror if one fails to continue to the other?

Execute-Process -Path "dirfiles\SaRACMD\Saracmd.exe" '-S OfficeScrubScenario -AcceptElua -CloseOffice -OfficeVersion ALL" -ContinueOnError:$True

Execute-Process -Path "$scriptDirectory\Files\MS_Office_2021_Uninstall\setup.exe" -Param,eters '/configure uninstall.xml' -ContinueOnError:$True

You should be able to run those 2 lines, one after the other, if you use -ContinueOnError $true

You could add Write-log lines before and after these lines.
If you see the extra log file entries in the PSADT log file (or not) , you will know for sure what is going on.

Thank u I will give it a shot!