zoukankan      html  css  js  c++  java
  • 通过PowerShell卸载所有的SharePoint 2010 解决方案

    通过PowerShell卸载所有的SharePoint 2010 解决方案

            为了演示,我经常需要拆毁再重建SharePoint 2010 环境。
            我经常需要用到的操作就是移除demo开发环境中所有安装的SharePoint 解决方案。
            这里是PowerShell脚本。它节省了我大量的时间,我希望也能给你带来帮助。
    脚本:
    function Uninstall-AllSPSolutions {
        param (
            [switch] $Local,
            [switch] $Confirm
        ) 
    
      Start-SPAssignment -Global;
      foreach($solution in (Get-SPSolution | Where-Object { $_.Deployed })) {
        write-host "Uninstalling Solution " $solution.Name;
        if($solution.DeployedWebApplications.Count -gt 0) {
          Uninstall-SPSolution $solution –AllWebApplications -Local:$Local -Confirm:$Confirm;
        } else {
          Uninstall-SPSolution $solution -Local:$Local -Confirm:$Confirm;
        }
        do {
          Start-Sleep 5;
          $solution = Get-SPSolution $solution;
        } while($solution.JobExists -and $solution.Deployed) 
      } 
      Stop-SPAssignment -Global;
    }
    
    function Remove-AllSPSolutions {
        param (
            [switch] $Confirm
        ) 
        Get-SPSolution | Where-Object { !$_.Deployed } | Remove-SPSolution -Confirm:$Confirm
    }
    使用方法:
            如果你保存脚本到文件,比如说是Remove-AllSPSolutions.ps1,然后在PowerShell调用时,记得要在前面这样写:
    ..Remove-AllSPSolutions.ps1
           你可以使用下面命令卸载所有部署的解决方案:
    Uninstall-AllSPSolutions -Confirm
            然后移除它们:
    Remove-AllSPSolutions -Confirm
  • 相关阅读:
    React 源码剖析系列 - 生命周期的管理艺术
    大数据浪潮下的前端工程师
    win7 秘钥
    Immutable 详解及 React 中实践
    js 设置日期函数
    node 一站式 学习 教程
    Python_如何定义带参数的装饰器?
    Python-装饰器中保留被装饰函数元数据
    Python-用装饰器实现递归剪枝
    Python-通过实例方法调用-统一接口的实现-getter methodcaller
  • 原文地址:https://www.cnblogs.com/crazygolf/p/3856658.html
Copyright © 2011-2022 走看看