Revert-M365AppsFrom2104.ps1

<#PSScriptInfo
.VERSION 1.0
.GUID ea95d532-3b54-48b0-97ef-45f16237e277
.AUTHOR Colin Cogle
.COPYRIGHT (c) 2021 Colin Cogle. All Rights Reserved. Licensed under the AGPLv3.
.TAGS Microsoft, screwed, up, again, 2104, Office, 2016, 2019, Current Channel, Outlook, bug, email
.LICENSEURI https://www.gnu.org/licenses/agpl-3.0.en.html
.PROJECTURI https://gist.github.com/rhymeswithmogul/f6d5c37ed3058802e9cb94e637e989c9
.RELEASENOTES Version 2104 of the M365 Apps are breaking various things in Outlook.
#>


<#
.SYNOPSIS
Rolls back the Microsoft 365 Apps for business/enterprise to version 2102.
 
.DESCRIPTION
Rolls back the Microsoft 365 Apps for business/enterprise to version 2102, to work around a bug affecting the display of email signatures, compose windows, and display. Note that you must go in there afterwards and disable updates until Microsoft has a hotfix available.
 
.NOTES
For more information, check your Microsoft 365 Admin Center for EX255650.
#>
 

Param()


$C2RClientPath = '\Common Files\microsoft shared\ClickToRun\OfficeC2RClient.exe'
$C2RParameters = @('/update user', 'updatetoversion=16.0.13801.20294')

$64bitOffice = Join-Path -Path $env:ProgramFiles -ChildPath $C2RClientPath
$32BitOffice = Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath $C2RClientPath

If (Test-Path -Path $64BitOffice) {
    Write-Output 'Rolling back the Microsoft 365 Apps to version 2102.'
    Start-Process -FilePath $64BitOffice -ArgumentList $C2RParameters
}
ElseIf (Test-Path -Path $32BitOffice) {
    Write-Output 'Rolling back the Microsoft 365 Apps to version 2102.'
    Start-Process -FilePath $32BitOffice -ArgumentList $C2RParameters
}
Else {
    Write-Error 'The Microsoft 365 Apps are not installed on this computer.'
}