A customer reported the “No snap-ins have been registered for Windows PowerShell version 2.” Error message running their code on a windows 2008 r2 server box.
They were running code that would haven run inside a c# application which called used the Microsoft.Exchange.Management.Powershell.Admin namespace to call the powershell enable-mailbox cmdlet.
On cause of this error message is worth checking how you are registering the snapin on W2K8 R2? We have seen instances where customers used wrong version of installutil.exe and the snapin got registered under WOW hives of a 64bit machine. The Installer tool (Installutil) allows you to install and uninstall server resources by executing installer components in specified assemblies. Check if you are using the correct version of installutil – Framework64 version of installutil.exe to register snapins and trying to load the snapin from a 64bit process.
Also review the shortcut to powershell, are you loading up the 32 bit version of 64 bit? When looking at the properties of the shortcuts to Powershell and Powershell(x86) on the start menu they may point to “%SystemRoot%\System32\WindowsPowerShell\V1.0” and “%SystemRoot%\SysWOW64\WindowsPowerShell\V1.0”. check if you intend to run the 32bit version or not?