Error:
The following error was generated when "$error.Clear();
$regPath='HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall';
$PackageGUIDRegEx = "{9BBCB5[0-9a-fA-F]{2}-AAC3-4BF5-[0-9a-fA-F]{4}-A4D51A19BF14}";
$InstallPath = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\setup').MsiInstallPath;
if(test-path ($regPath))
{
Write-ExchangeSetupLog -info ("Removing " + $RoleLanguagePackType + " Language Packs.");
Get-ChildItem ($regPath) | foreach{
if($_ -match "(?$PackageGUIDRegEx)") {
$langPackPackageCode = $matches['ProductCode'];
if($langPackPackageCode -ne $null -and $langPackPackageCode.Length -ne 0) {
Write-ExchangeSetupLog -info ("Removing package $langPackPackageCode");
$language = $langPackPackageCode.Substring(20,4);
$logFilePath = [IO.Path]::Combine($RoleLogFilePath,"Uninstall") + '.' + $language + '.' + "OwaPlus" + "." + $RoleLogDateTime + ".msilog";
uninstall-MsiPackage -ProductCode ($langPackPackageCode) -LogFile ($logFilePath);
};
};
};
Get-Childitem -Path $InstallPath -include "*.Localized.js","*.Localized.min.js" -recurse | foreach ($_) {remove-item $_.fullname};
Write-ExchangeSetupLog -info "Remove Language Packs completed.";
};
" was run: "System.UnauthorizedAccessException: Access is denied ---> System.ComponentModel.Win32Exception: Access is denied
--- End of inner exception stack trace ---
at System.Management.Automation.Utils.NativeDirectoryExists(String path)
at System.Management.Automation.SessionStateInternal.IsItemContainer(CmdletProvider providerInstance, String path, CmdletProviderContext context)".
The uninstallation was successfully finalized through the command line after a server restart. All steps were completed without any issues.
C:\>Setup.exe /mode:Uninstall
Microsoft Exchange Server 2016 Cumulative Update 23 Unattended Setup
Mailbox role: Mailbox service
Mailbox role: Unified Messaging service
Mailbox role: Client Access service
Mailbox role: Transport service
Mailbox role: Front End Transport service
Mailbox role: Client Access Front End service
Languages
Performing Microsoft Exchange Server Prerequisite Check
Configuring Prerequisites COMPLETED
Configuring Microsoft Exchange Server
Preparing Setup COMPLETED
Language Files COMPLETED
Stopping Services COMPLETED
Removing Exchange Files COMPLETED
Restoring Services COMPLETED
Finalizing Setup COMPLETED
The Exchange Server setup operation completed successfully.