locked
How to install Sharepoint powershell to MOSS 2007

    Question

  • I have MOSS farm on windows 2003 x64 server. I have installed Powershell 2.0 and I am able to run all windows powershell command but not able to rum Sharepoint cmdlets.

    I tried adding the snap by running Add-PSSnapin Microsoft.SharePoint.PowerShell command in powershell but it gives below error

    Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2.
    At line:1 char:14
    +  Add-PSSnapin <<<<  Microsoft.SharePoint.PowerShell
        + CategoryInfo          : InvalidArgument: (Microsoft.SharePoint.PowerShell:String) [Add-PSSnapin], PSArgumentExce
       ption
        + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

    Tuesday, December 13, 2011 11:52 AM

Answers

  • Sarah --

    I think you're confusing the difference between PowerShell and the various snap-ins that are available to extend its functionality for specific Microsoft platforms. Many, if not all, of Microsoft's server platform products now ship with PowerShell snap-ins that provide a great deal of additional functionality for managing that target platform from the command line. For example, since its 2007 release Exchange has provided a PowerShell snap-in with cmdlets to help automate common activities such as creating mailboxes in a manner proscribed by the Exchange product team, and with the 2010 release of SharePoint came a management snap-in that can provides cmdlets to back up your farm, create site collections, and much more. But SharePoint's 2007 (WSS v3 and MOSS 2007) did not ship with a PowerShell snap-in or cmdlets created by Microsoft to manage the platform. The SharePoint product team was not able to build out those resources in time to make SharePoint 2007's shipping window, so instead they stayed the course with the STSADM command line administration tool.

    But, it's still entirely possible to use PowerShell with SharePoint 2007, you just don't have access to cmdlets written by Microsoft specifically for the platform. Instead, you'll have to write your own cmdlets that work with SharePoint by either calling STSADM operations or calling the SharePoint object model through PowerShell's object-orients and .NET capabilities. Or, you can download some pre-built PowerShell scripts, modules, or cmdlets from one of the resource centers I linked to above.

    I'm not surprised to hear that you've used PowerShell in your WSS environment, its definitely possible and I'm thrilled to hear that you did. But you were not using a Microsoft-provided snap-in for that environment, because one does not exist for WSS v3/MOSS 2007. You can install PowerShell in Windows Server 2003 or 2008 and use it with them, but you're on your own with regards to cmdlets for it.

    John


    MCITP and MCTS: SharePoint, Virtualization, Project Server 2007
    My books on Amazon: The SharePoint 2010 Disaster Recovery Guide and The SharePoint 2007 Disaster Recovery Guide.
    My blog: My Central Admin.
    • Marked as answer by Sarah Abs Friday, December 16, 2011 4:33 PM
    Tuesday, December 13, 2011 5:38 PM
  • Unfortunately SharePoint 2010's Management Shell (it's PowerShell snap-in and associated cmdlets) is not compatible with MOSS 2007 and there aren't cmdlets available directly from Microsoft for that version of SharePoint.

    What that means is that you can still use PowerShell with MOSS 2007, but you're either going to have to write your own cmdlets that use STSADM or the SharePoint Object Model directly, or you're going to have to use MOSS 2007-compatible cmdlets from a third party. I'd suggest checking out Gary Lapointe's blog for a lot of great PowerShell cmdlets for MOSS 2007 (http://blog.falchionconsulting.com/), or places where people upload cmdlets such as CodePlex.com, the TechNet Script Repository, POSHCode.org, or http://get-spscripts.com/.

    John


    MCITP and MCTS: SharePoint, Virtualization, Project Server 2007
    My books on Amazon: The SharePoint 2010 Disaster Recovery Guide and The SharePoint 2007 Disaster Recovery Guide.
    My blog: My Central Admin.
    Tuesday, December 13, 2011 12:12 PM

All replies

  • Unfortunately SharePoint 2010's Management Shell (it's PowerShell snap-in and associated cmdlets) is not compatible with MOSS 2007 and there aren't cmdlets available directly from Microsoft for that version of SharePoint.

    What that means is that you can still use PowerShell with MOSS 2007, but you're either going to have to write your own cmdlets that use STSADM or the SharePoint Object Model directly, or you're going to have to use MOSS 2007-compatible cmdlets from a third party. I'd suggest checking out Gary Lapointe's blog for a lot of great PowerShell cmdlets for MOSS 2007 (http://blog.falchionconsulting.com/), or places where people upload cmdlets such as CodePlex.com, the TechNet Script Repository, POSHCode.org, or http://get-spscripts.com/.

    John


    MCITP and MCTS: SharePoint, Virtualization, Project Server 2007
    My books on Amazon: The SharePoint 2010 Disaster Recovery Guide and The SharePoint 2007 Disaster Recovery Guide.
    My blog: My Central Admin.
    Tuesday, December 13, 2011 12:12 PM
  • John, I am not sure if you are right regarding usage of Powershell with MOSS. In my WSS environment I have use it but not sure how it was installed.

    Thanks any way for your answer.

    Tuesday, December 13, 2011 1:13 PM
  • Sarah --

    I think you're confusing the difference between PowerShell and the various snap-ins that are available to extend its functionality for specific Microsoft platforms. Many, if not all, of Microsoft's server platform products now ship with PowerShell snap-ins that provide a great deal of additional functionality for managing that target platform from the command line. For example, since its 2007 release Exchange has provided a PowerShell snap-in with cmdlets to help automate common activities such as creating mailboxes in a manner proscribed by the Exchange product team, and with the 2010 release of SharePoint came a management snap-in that can provides cmdlets to back up your farm, create site collections, and much more. But SharePoint's 2007 (WSS v3 and MOSS 2007) did not ship with a PowerShell snap-in or cmdlets created by Microsoft to manage the platform. The SharePoint product team was not able to build out those resources in time to make SharePoint 2007's shipping window, so instead they stayed the course with the STSADM command line administration tool.

    But, it's still entirely possible to use PowerShell with SharePoint 2007, you just don't have access to cmdlets written by Microsoft specifically for the platform. Instead, you'll have to write your own cmdlets that work with SharePoint by either calling STSADM operations or calling the SharePoint object model through PowerShell's object-orients and .NET capabilities. Or, you can download some pre-built PowerShell scripts, modules, or cmdlets from one of the resource centers I linked to above.

    I'm not surprised to hear that you've used PowerShell in your WSS environment, its definitely possible and I'm thrilled to hear that you did. But you were not using a Microsoft-provided snap-in for that environment, because one does not exist for WSS v3/MOSS 2007. You can install PowerShell in Windows Server 2003 or 2008 and use it with them, but you're on your own with regards to cmdlets for it.

    John


    MCITP and MCTS: SharePoint, Virtualization, Project Server 2007
    My books on Amazon: The SharePoint 2010 Disaster Recovery Guide and The SharePoint 2007 Disaster Recovery Guide.
    My blog: My Central Admin.
    • Marked as answer by Sarah Abs Friday, December 16, 2011 4:33 PM
    Tuesday, December 13, 2011 5:38 PM
  • Bang on target. Thanks a lot..
    Friday, December 16, 2011 4:33 PM