Whenever you’re writing aPowerShell SnapIn you may encounter an error when you try to load the PSSnapIn.
Specifically, when the error states:
Add-PSSnapin : Cannot load Windows PowerShell snap-in because of the following error: Could not load file or assembly or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Now this is a nasty little thing to find the cause of so I’ve decided to write this blog post.
The solution for this, at least in my case, was to create a powershell.exe.config file in the PowerShell folder (for x86 ‘%windir%\System32\WindowsPowerShell\V1.0‘ and for x64 ‘%windir%\Syswow64\WindowsPowerShell\V1.0′).
In this file, place the following content:
<CONFIGURATION>
<STARTUP useLegacyV2RuntimeActivationPolicy="true">
<SUPPORTEDRUNTIME version="v4.0.30319"></SUPPORTEDRUNTIME>
<SUPPORTEDRUNTIME version="v2.0.50727"></SUPPORTEDRUNTIME>
</STARTUP>
</CONFIGURATION>
Now restart your PowerShell console (if it’s opened at that time) and you’re set

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 
Pingback: Microsoft Most Valuable Professional (MVP) – Best Posts of the Week around Windows Server, Exchange, SystemCenter and more – #12 - TechCenter - Blog - TechCenter – Dell Community
Pingback: Microsoft Most Valuable Professional (MVP) – Best Posts of the Week around Windows Server, Exchange, SystemCenter and more – #12 - Dell TechCenter - TechCenter - Dell Community