Today I was updating Exchange Server 2016 CU 18 on one of the clients Exchange Server and I came across the below error. The error is the original web.config file was not able to back up because of a web.config.bak file was already there in the %ExchangeInstall%\ClientAccess\ Autodiscover\. Error: ” was run: “System.UnauthorizedAccessException”
" was run: "System.UnauthorizedAccessException: Access to the path 'C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\Autodiscover\web.config.bak' is denied. at System.IO .__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO .File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost) at Microsoft.Exchange.Management .SetInstallPathInAppConfig.InternalProcessRecord() at Microsoft.Exchange .Configuration.Tasks.Task.<ProcessRecord>b__91_1() at Microsoft.Exchange .Configuration.Tasks.Task.InvokeRetryableFunc(String funcName, Action func, Boolean terminatePipelineIfFailed) at Microsoft.Exchange .Configuration.Tasks.Task.ProcessTaskStage(TaskStage taskStage, Action initFunc, Action mainFunc, Action completeFunc) at Microsoft.Exchange .Configuration.Tasks.Task.ProcessRecord() at System.Management .Automation.CommandProcessor.ProcessRecord()".
In order to resolve this issue, I have backed up the existing web.config.bak file and removed this file from the location above. I reran the setup again and, Bingo! There was no error on the stage and the Cumulative update completed with charm. I recommend this solution if you come across this issue in your Exchange Server 2013/1016/2019 cumulative update upgrade.
Please feel to comment your thoughts and I will right there to answer you incase of any questions.