Fixing PowerShell snap-in issue on SharePoint 2010 Foundation

When trying to load SharePoint snap-in to PowerShell, you will see the following error:

 

PS C:\Users\Administrator> add-pssnapin microsoft.sharepoint.powershell
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2.
At line:1 char:13
+ add-pssnapin <<<< microsoft.sharepoint.powershell
+ CategoryInfo : InvalidArgument: (microsoft.sharepoint.powershell:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

This is because by default PowerShell v.1.0 is installed on Windows Server 2008.

You may have to download and install PowerShell v.2.0  ???

or (better tricky)

run C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -Version 2 -NoExit

then add-pssnapin microsoft.sharepoint.powershell

 

! Unfortunately, this trick doesn’t work in Powershell ISE so prepare to use command shell only 🙁

Fixing PowerShell snap-in issue on SharePoint 2010 Foundation