zoukankan      html  css  js  c++  java
  • Managing SharePoint 2010 Farm Solutions with Windows PowerShell

    http://blog.softartisans.com/2011/01/24/managing-sharepoint-2010-farm-solutions-with-windows-powershell/

    Adding solution to the solution store

    Prerequisite: None

    stsadm
    stsadm -o addsolution -filename SampleSolution.wsp
    PowerShell
    add-spsolution -literalpath c:\solutions\SampleSolution.wsp

    Because of the way PowerShell handles file path, the cmdlet’s -literalpath switch only accepts a full path to the WSP file. Using a relative path will result in a File Not Found error.

    Deploying solution

    Prerequisite: The solution has been added to the solution store.

    stsadm
    stsadm -o deploysolution -name SampleSolution.wsp -url http://server -allowGacDeployment -force  -immediate
    stsadm -o execadmsvcjobs
    PowerShell
    install-spsolution -identity SampleSolution.wsp -webapplication http://server -gacdeployment -force

    This solution contains an assembly which must be registered in Web.config (as a SafeControl), so I use the -url switch with stsadm to specify the location of the desired Web application (to which Web.config belongs); alternatively, I could also use the -allcontenturls switch to deploy to all non-administrative web applications. With PowerShell, the -webapplication switch performs the same purpose.

    With stsadm it’s also a good idea to run execadmsvcjobs to ensure that the operation is performed immediately. The cmdlet performs this step automatically.

    Upgrading solution

    Prerequisite: The solution is currently deployed.

    stsadm
    stsadm -o upgradesolution -name SampleSolution.wsp -filename SampleSolution.wsp -immediate -allowgacdeployment
    stsadm -o execadmsvcjobs
    PowerShell
    update-spsolution -identity SampleSolution.wsp -literalpath c:\solutions\SampleSolution.wsp -gacdeployment

    Again, note that the cmdlet’s -literalpath switch requires a full path to the WSP file.

    Retracting solution

    Prerequisite: The solution is currently deployed.

    stsadm
    stsadm -o retractsolution -name SampleSolution.wsp -immediate
    stsadm -o execadmsvcjobs
    PowerShell
    uninstall-spsolution -identity SampleSolution.wsp -webapplication http://server -confirm:$false

    As mentioned in the section Deploying solution, the solution requires modification to Web.config. With PowerShell, you must specify with the -webapplication switch the Web application from which the solution is to be retracted. Failure to do so will result in the following error:

    Uninstall-SPSolution : This solution contains resources scoped for a Web application and must be retracted from one or more Web applications.

    The cmdlet asks you to confirm the operation before proceeding. For a completely automated operation, you can turn off the confirmation with the -confirm switch.

    Removing solution from solution store

    Prerequisite: The solution has been retracted.

    stsadm
    stsadm -o deletesolution -name SampleSolution.wsp -override
    PowerShell
    remove-spsolution -identity SampleSolution.wsp -confirm:$false
  • 相关阅读:
    在Spring中使用cache(EhCache的对象缓存和页面缓存)
    halcon 模板匹配 -- 转化 vector_angle_to_rigid
    halcon 模板匹配 -- find_shape_model
    halcon 模板匹配 -- create_shape_model
    C#快速获取指定网页源码的几种方式,并通过字符串截取函数 或 正则 取指定内容(IP)
    C# Socket通讯 本机多网卡,指定网卡通讯
    C# 获取所有网卡信息
    C#关闭退出线程的几种方法
    C#多线程方法 可传参
    C# Datetime 使用详解
  • 原文地址:https://www.cnblogs.com/yanlixin/p/2453564.html
Copyright © 2011-2022 走看看