Installing Office 2021

Hi Guys

I am very new to powershell so any help would be greatly appreciated. I am looking to uninstall Office 2019 then install Office 2021 using deployment toolkit. I am having issues where the officescrub requires a reboot to finish uninstall before it installs 2021 but if I restart the 2021 install does not happen. I tested the the script on a machine that does not have 2019 installed and 2021 installs successfully. Do you guys see anything worng in my script?

Show Progress Message (with the default message)


	## <Perform Pre-Installation tasks here> 
        Execute-Process -FilePath “$envWinDir\System32\cscript.exe” -Parameters “”"$dirFiles\OffScrubC2R.vbs"""  -Wait

	[string]$installPhase = 'Installation'

	## Handle Zero-Config MSI Installations
	If ($useDefaultMsi) {
		[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Install'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
		Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }

	## <Perform Installation tasks here>
        Execute-Process -FilePath "$dirFiles\Microsoft Office 2021 Professional\setup.exe" -Parameters '/configure configuration.xml' -WindowStyle Hidden

scrubbing is only required if there are environment issues.

use the office 2021 configuration xml to uninstall previous version

The path hast TO be “$dirFiles\configuration.xml” …

Thank yous omuch its working now

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.