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,163 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now