2

when opening the sharepoint 2013 management shell, I get the error

Add-PsSnapin : Cannot load Windows PowerShell snap-in Microsoft.SharePoint.PowerShell because of the following error: Unable to cast object of type 'Microsoft.SharePoint.PowerShell.SPCmdletSnapIn' to type 'System.Management.Automation.CustomPSSnapIn'. At C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONFIG\POWERSHELL\Registration\SharePoint.ps1:3 char:1 + Add-PsSnapin Microsoft.SharePoint.PowerShell + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.SharePoint.PowerShell:St ring) [Add-PSSnapin], PSSnapInException + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad dPSSnapinCommand

system is sharepoint 2013 sp1 enterprise, windows server 2012 r2, farm, non production, power shell 4.0, sql server 2012

after the window opens, I cannot run any cmdlets - which given the error seems understandable. I wanted to create a host-named site collection which can only be done via powershell.

the user is in the sql server SharePoint_Shell_Access role for the sharepoint_config db.

suggestions which have not worked include uninstalling windows management framework 3.0 which does not apply, running the shell in elevated mode

suggestions which will not be tried include uninstalling/reinstalling sharepoint, downgrading windows server

does anyone know how to fix this problem?

5
  • how many servers? and is it brand new installation?
    – Waqas Sarwar MVP
    Oct 10, 2014 at 21:55
  • 1 server and brand new installation
    – tony bonn
    Oct 13, 2014 at 14:10
  • for those who may encounter problems using sharepoint 2013 management shell as described above, they may be due to problematic upgrades from a previous windows version. in our case we upgraded from windows server 2008 r2 to windows 2012 r2. Microsoft has instructed us to install a fresh windows server 2012 r2 before installing sharepoint 2013 sp1 as they do not know how to resolve this specific problem without the fresh installation. I will report back the results of the fresh installation.
    – tony bonn
    Oct 16, 2014 at 15:58
  • 2
    installing an original full windows server 2012 r2 allowed me to install sharepoint 2013 sp1 with management shell working. the bottom line is that Microsoft does not support upgraded installations of windows server 2012 r2 for sharepoint 2013 sp1 installation.
    – tony bonn
    Oct 17, 2014 at 14:27
  • Good follow up @tonybonn with your findings . Appreciated.
    – Arvi
    Nov 18, 2014 at 4:17

1 Answer 1

0

This has worked for me. We have done in place OS upgrade from 2008 R2 to 2012 R2 with SP 2013 SP1.

'The Windows PowerShell snap-in'Microsoft.SharePoint.PowerShell is not installed on this machine' on SP Server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.