After applying an update roll-up to Exchange 2010 server I ran into a problem when running the powershell script UpdateCas.ps1. This is the script updates the OWA site in IIS to fix the error where OWA could not initialize (usually with the error Couldn’t find a base theme (folder name=base)). It appears this script must be run each time Exchange is updated.
Unfortunately, when I tried to run the script in EMS I received the following error:
[PS] C:\Users\Administrator.000>cd “C:\Program Files\Microsoft\Exchange Server\V14\Bin”
[PS] C:\Program Files\Microsoft\Exchange Server\V14\Bin>UpdateCas.ps1
Add-PSSnapin : The Windows PowerShell snap-in ‘Microsoft.Exchange.Management.PowerShell.E2010’ is not installed on this machine.
At C:\Program Files\Microsoft\Exchange Server\V14\bin\UpdateCas.ps1:36 char:13
+ add-PSSnapin <<<< -Name Microsoft.Exchange.Management.PowerShell.E2010
+ CategoryInfo : InvalidArgument: (Microsoft.Excha…owerShell.E2010:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
[10:00:01] ***********************************************
[10:00:01] * UpdateCas.ps1: 10/26/2014 10:00:01 AM
[10:00:04] Updating OWA/ECP on server DELLR710
[10:00:04] Finding ClientAccess role install path on the filesystem
[10:00:05] Updating OWA to version 14.3.174.1
[10:00:05] Copying files from 'C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\owa\Current' to 'C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\owa\14.3.174.1'
[10:00:11] Found 1 OWA virtual directories.
[10:00:11] Updating OWA virtual directories
[10:00:11] Processing virtual directory with metabase path 'IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa'.
[10:00:11] Creating metabase entry IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa/14.3.174.1.
[10:00:11] Configuring metabase entry 'IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa/14.3.174.1'.
[10:00:11] Saving changes to 'IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa/14.3.174.1'
[10:00:11] Saving changes to 'IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa'
[10:00:11] Update OWA done.
[10:00:11] Updating ECP to version 14.3.174.1
[10:00:11] Copying files from 'C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\ecp\Current' to 'C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\ecp\14.3.174.1'
[10:00:12] Update ECP done.
Remove-PSSnapin : No Windows PowerShell snap-ins matching the pattern 'Microsoft.Exchange.Management.PowerShell.E2010' were found. Check the pattern and then try the command again.
At C:\Program Files\Microsoft\Exchange Server\V14\bin\UpdateCas.ps1:154 char:16
+ remove-PSSnapin <<<< -Name Microsoft.Exchange.Management.PowerShell.E2010
+ CategoryInfo : InvalidArgument: (Microsoft.Excha…owerShell.E2010:String) [Remove-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : NoPSSnapInsFound,Microsoft.PowerShell.Commands.RemovePSSnapinCommand
The update removed the E2010 and Support keys from the registry that the EMS was trying to call. Apparently Microsoft doesn’t want you running EMS scripts at the server. Instead we should be running them from a remote workstation. To see which plugins were available I ran the following command:
[PS] C:\Program Files\Microsoft\Exchange Server\V14\Bin>Get-PSSnapin –Registered
Name : Microsoft.Exchange.Management.PowerShell.Setup
PSVersion : 1.0
Description : Setup Tasks for the Exchange Server
Name : Windows.ServerBackup
PSVersion : 2.0
Description : This Windows PowerShell snap-in for Windows Server Backup contains cmdlets used to configure, run, and manage backups.
According to the command only two plugins have been installed. Fortunately the fix is easy – two keys need to be added to the registry. The two plugins that need their information added to the registry are Admin Tasks for the Exchange Server and Support Tasks for the Exchange Server. You can export the keys from a working Exchange server or you can create .reg files using the Pastebins below and merge the files.
Create two registry files by copying and pasting the code from Pastebin and then merge them by right-clicking on each one and selecting Merge. There is no need to reboot or restart Exchange services.

Now, when the Powershell script is run it completes without error:
[PS] C:\Program Files\Microsoft\Exchange Server\V14\Bin>UpdateCas.ps1
[10:48:17] ***********************************************
[10:48:17] * UpdateCas.ps1: 10/26/2014 10:48:17 AM
[10:48:17] Updating OWA/ECP on server DELLR710
[10:48:17] Finding ClientAccess role install path on the filesystem
[10:48:17] Updating OWA to version 14.3.174.1
[10:48:17] Copying files from ‘C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\owa\Current’ to ‘C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\owa\14.3.174.1’
[10:48:18] Found 1 OWA virtual directories.
[10:48:18] Updating OWA virtual directories
[10:48:18] Processing virtual directory with metabase path ‘IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa’.
[10:48:18] Metabase entry ‘IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa/14.3.174.1’ exists. Removing it.
[10:48:18] Creating metabase entry IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa/14.3.174.1.
[10:48:18] Configuring metabase entry ‘IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa/14.3.174.1’.
[10:48:18] Saving changes to ‘IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa/14.3.174.1’
[10:48:18] Saving changes to ‘IIS://DELLR710.AP.local/W3SVC/1/ROOT/owa’
[10:48:18] Update OWA done.
[10:48:18] Updating ECP to version 14.3.174.1
[10:48:18] Copying files from ‘C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\ecp\Current’ to ‘C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\ecp\14.3.174.1’
[10:48:19] Update ECP done.
[PS] C:\Program Files\Microsoft\Exchange Server\V14\Bin>
The following image shows the two new entries for the missing plugins in the registry:

Registry code for Support Tasks on Pastebin
Registry code for Support Tasks on Pastebin