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,485 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

695 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