Script didn't worked for me on the first try. The script does not allow enough time for the transport service to stop and the script is unable to delete the required files :
[PS] C:\temp>.\Reset-ScanEngineVersion.ps1
EXCH1 Stopping services...
Stop-Service : Time out has expired and the operation has not been completed.
At C:\temp\Reset-ScanEngineVersion.ps1:42 char:13
+ Stop-Service FMS -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Stop-Service], TimeoutException
+ FullyQualifiedErrorId : System.ServiceProcess.TimeoutException,Microsoft.PowerShell.Commands.StopServiceCommand
EXCH1 Removing Microsoft engine folder...
Remove-Item : Cannot remove item C:\Program Files\Microsoft\Exchange Server\V15\FIP-FS\Data\Engines\amd64\Microsoft\bin: The directory is not empty.
At C:\temp\Reset-ScanEngineVersion.ps1:54 char:17
+ Remove-Item -Recurse -Force $microsoftFolder
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (bin:DirectoryInfo) [Remove-Item], IOException
+ FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand
Remove-Item : Cannot remove item C:\Program Files\Microsoft\Exchange Server\V15\FIP-FS\Data\Engines\amd64\Microsoft: The directory is not empty.
If someone else have the same issue, just stop the MSExchangeTransport manually and run the script again.