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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
This article will help you understand what HashTables are and how to use them in PowerShell.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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