Solved

SP2013 Manag.PowerShell Problem:  Cannot load Windows PowerShell snap-in Microsoft.SharePoint.PowerShell because of the following error: Could not load file or assembly

Posted on 2013-12-13
5
3,293 Views
Last Modified: 2013-12-13
Hello,

I can't start the SharePoint 2013 Management Shell, if I click on the link, it returns the following:

May someone help me with this ?



Add-PsSnapin : Cannot load Windows PowerShell snap-in Microsoft.SharePoint.PowerShell because of the following error: Could not load file or assembly
'file:///C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.SharePoint.PowerShell\v4.0_15.0.0.0__71E9BCE111E9429C\Microsoft.SharePoint.PowerShell.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
At C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONFIG\POWERSHELL\Registration\SharePoint.ps1:3 char:13
+ Add-PsSnapin <<<<  Microsoft.SharePoint.PowerShell
    + CategoryInfo          : InvalidArgument: (Microsoft.SharePoint.PowerShell:String) [Add-PSSnapin], PSSnapInException
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

Open in new window

0
Comment
Question by:Sa5cha
  • 3
  • 2
5 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 39716241
Hi,
seems that you are using the wrong Powershell version.

What happens if you open a Powershell window (not the SharePoint Management Shell) and you enter:
$host.Version

Open in new window

Does this return 3.0?
If not please install Powershell V3.

If this does return V3, then run the same command in SharePoint Management shell.
If this returns V2, check the shortcut to the SharePoint Management shell if it contains a command line swith "-version" and if this one is set to v2 change it to v3.

HTH
Rainer
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39716252
And if the above does not help, you might try the steps mentioned in this blog post:
http://oztripwire.blogspot.de/2013/04/sharepoint-2013-powershell-woes-and.html

HTH
Rainer
0
 

Author Comment

by:Sa5cha
ID: 39716471
Hi Rainer,

good hint on the sp2013 where the sps ps isnt workings its:

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1

the sp2013 farm where its working its

Major  Minor  Build  Revision
-----  -----  -----  --------
3     0      -1     -1

Ill try to switch and give you a feedback

Sascha
0
 

Author Comment

by:Sa5cha
ID: 39716495
System where SP2013 PS showing the error:

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -Version 2 -NoExit  " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONFIG\POWERSHELL\Registration\\sharepoint.ps1

Changed the Version from 2 to 3:

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -Version 3 -NoExit  " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "

Result: SPS PS now starting with out an error.

Thank you Rainer
0
 

Author Comment

by:Sa5cha
ID: 39716504
I've requested that this question be closed as follows:

Accepted answer: 500 points for RainerJ's comment #a39716241
Assisted answer: 0 points for Sa5cha's comment #a39716495

for the following reason:

It solved the problem now, SPS PS now starting in Version 3 without errors. Thank you rainer.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Synchronize a new Active Directory domain with an existing Office 365 tenant
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question