Wednesday, April 16, 2014

Exchange 2013 setup Error: The virtual directory ‘PowerShell’ already exists under ‘exchange hostname (FQDN)/Default Web Site’.

While am working in Exchange migration the customer decided to convert on of the archive servers to Mailbox server, so we uninstalled the Exchange from that machine in order to change the host name after we changed the host name and located the new LUN for this new mailbox server I faced the following errors while re-installing the Mailbox role on the same server:



Step 7 of 12: MailBox Role: Transport Service

Error:
The following error was generated when "$error.Clear();
          $vdirName = "PowerShell";
          $InternalPowerShellUrl="http://" + $RoleFqdnOrName + "/powershell";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -InternalUrl $InternalPowerShellUrl -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$false -RequireSSL:$false -WebSiteName "Default Web Site" -AppPoolId "MSExchangePowerShellFrontEndAppPool";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$true -RequireSSL:$true -WebSiteName "Exchange Back End" -Path ($RoleInstallPath + "ClientAccess\PowerShell-Proxy");
        " was run: "The virtual directory 'PowerShell' already exists under 'ExchangeServerFQDN/Default Web Site'.
Parameter name: VirtualDirectoryName".

And



Error:
The following error was generated when "$error.Clear();
          $vdirName = "PowerShell";
          $InternalPowerShellUrl="http://" + $RoleFqdnOrName + "/powershell";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -InternalUrl $InternalPowerShellUrl -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$false -RequireSSL:$false -WebSiteName "Default Web Site" -AppPoolId "MSExchangePowerShellFrontEndAppPool";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$true -RequireSSL:$true -WebSiteName "Exchange Back End" -Path ($RoleInstallPath + "ClientAccess\PowerShell-Proxy");
        " was run: "The AD configuration for virtual directory 'PowerShell' already exists in 'CN=PowerShell (Exchange Back End),CN=HTTP,CN=Protocols,CN=ExchangeServer,CN=Servers,CN=Exchange Administrative Group (),CN=Administrative Groups,CN=Domain,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Domain,DC=Root', please remove this AD configuration manually.
Parameter name: VirtualDirectoryName".

And

Error:
The following error was generated when "$error.Clear();
          $vdirName = "PowerShell";
          $InternalPowerShellUrl="http://" + $RoleFqdnOrName + "/powershell";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -InternalUrl $InternalPowerShellUrl -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$false -RequireSSL:$false -WebSiteName "Default Web Site" -AppPoolId "MSExchangePowerShellFrontEndAppPool";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$true -RequireSSL:$true -WebSiteName "Exchange Back End" -Path ($RoleInstallPath + "ClientAccess\PowerShell-Proxy");
        " was run: "The AD configuration for virtual directory 'PowerShell' already exists in 'CN=PowerShell (Default Web Site),CN=HTTP,CN=Protocols,CN=ExchangeServer,CN=Servers,CN=Exchange Admdinistrative Group (),CN=Administrative Groups,CN=domain,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Domain,DC=Root', please remove this AD configuration manually.
Parameter name: VirtualDirectoryName".

Error:
The following error was generated when "$error.Clear();
          $vdirName = "PowerShell";
          $InternalPowerShellUrl="http://" + $RoleFqdnOrName + "/powershell";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -InternalUrl $InternalPowerShellUrl -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$false -RequireSSL:$false -WebSiteName "Default Web Site" -AppPoolId "MSExchangePowerShellFrontEndAppPool";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$true -RequireSSL:$true -WebSiteName "Exchange Back End" -Path ($RoleInstallPath + "ClientAccess\PowerShell-Proxy");
        " was run: "The virtual directory 'PowerShell' already exists under 'ExchangeServerFQDN/Exchange Back End'.
Parameter name: VirtualDirectoryName".

And

Error:
The following error was generated when "$error.Clear();
          $vdirName = "PowerShell";
          $InternalPowerShellUrl="http://" + $RoleFqdnOrName + "/powershell";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -InternalUrl $InternalPowerShellUrl -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$false -RequireSSL:$false -WebSiteName "Default Web Site" -AppPoolId "MSExchangePowerShellFrontEndAppPool";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$true -RequireSSL:$true -WebSiteName "Exchange Back End" -Path ($RoleInstallPath + "ClientAccess\PowerShell-Proxy");
        " was run: "The virtual directory 'PowerShell' already exists under 'ExchangeServerFQDN/Default Web Site'.
Parameter name: VirtualDirectoryName".

Error:
The following error was generated when "$error.Clear();
          $vdirName = "PowerShell";
          $InternalPowerShellUrl="http://" + $RoleFqdnOrName + "/powershell";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -InternalUrl $InternalPowerShellUrl -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$false -RequireSSL:$false -WebSiteName "Default Web Site" -AppPoolId "MSExchangePowerShellFrontEndAppPool";
          new-PowerShellVirtualDirectory $vdirName -Role Mailbox -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$true -RequireSSL:$true -WebSiteName "Exchange Back End" -Path ($RoleInstallPath + "ClientAccess\PowerShell-Proxy");
        " was run: "The virtual directory 'PowerShell' already exists under 'ExchangeServerFQDN/Exchange Back End'.
Parameter name: VirtualDirectoryName".



Resolution:


1- Delete Powershell site under default web site and on this server



2- Open ADSIEDT from AD server. Click on Action and select “connection”.
Select “Configuration” from the drop down in the   “Connection  Settings” dialog






Navigate to:
CN=Configuration,DC=domain,DC=suffix
CN=Services
CN=Microsoft Exchange
CN=[your domain]
CN=Administrative Groups
CN=Exchange Administrative Groups
CN=Servers
CN=[your server]
CN=Protocols
CN=HTTP


Find the (in the right pane) CN=Powershell (Default Web Site), and (Exchange Back End) …  and delete it



Also, Delete the follwong registry keys if it exist:

Open the registry editor and navigate to
KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\v14\MailboxRole
Find the “Action” key and delete it.




Navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager
Locate the “PendingFileRenameOperations” key and delete it.