BizTalk Powershell Provider on Windows Server 2008 R2

Today I ran into a problem while trying to use the BizTalk PowerShell Provider on a Windows Server R2 installation. I allready knew I would have to use the 32 bit version when working with the provider, however on starting up the console I received the following message:
Add-PSSnapin : Cannot load Windows PowerShell snap-in BizTalkFactory.Powershell.Extensions because of the following err or: Could not load file or assembly ‘file:///C:Program Files (x86)BizTalkFactory PowerShell ProviderBizTalkFactory.P owerShell.Extensions.dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently load ed runtime and cannot be loaded. At C:UsersAdministratorDocumentsWindowsPowerShellprofile.ps1:5 char:13 + Add-PSSnapin <<<< BizTalkFactory.Powershell.Extensions + CategoryInfo : InvalidArgument: (BizTalkFactory.Powershell.Extensions:String) [Add-PSSnapin], PSSnapInE xception + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

In the documentation for the provider it states it targets .NET 2.0, and that the configuration files should be changed to the following:

1
2
3
4
5
<configuration>
  <startup>
    <supportedRuntime version="v4.0.30319" />
  </startup>
</configuration>

This did however not solve my problem. After further investigation I found out you actually need following in the PowerShell configuration file:

1
2
3
4
5
6
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0.30319" />
    <supportedRuntime version="v2.0.50727" />
  </startup>
</configuration>

On a x64 system this file can be found here:

C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe.config

If the file does not yet exist, simply create it.

One thought on “BizTalk Powershell Provider on Windows Server 2008 R2

Leave a Reply

Your email address will not be published. Required fields are marked *