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
  • 相关阅读:
    .net中的目录
    select into in mysql
    内存泄漏调查
    【NO.3】 c program to caculate and display sum of two matrix
    LoadRunner获取一个独特的价值在执行的场景
    Android 基于Netty接收和发送推送解决方案的消息字符串(三)
    springmvc如何访问静态文件,例如jpg,js,css
    HTTP求
    SlopOne推荐算法
    回溯-01背包问题之二:连续工作模式
  • 原文地址:https://www.cnblogs.com/claireyuancy/p/6897067.html
Copyright © 2011-2022 走看看