通过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

最新文章

  1. iOS tableview自定义cell上添加按钮实现删除功能
  2. js点击按钮div显示,点击div或者body和按钮,div隐藏
  3. BZOJ2038: [2009国家集训队]小Z的袜子(hose)
  4. 怎样实现了捕获应用中的日志在android开发中
  5. Android LayoutParams简介
  6. 【ASP.NET MVC 5】第27章 Web API与单页应用程序
  7. php 显示某一个时间相当于当前时间在多少秒前,多少分钟前,多少小时前
  8. 标准I/O之实现细节
  9. Git的思想和基本工作原理
  10. HTML之学习笔记(十一)其它标签
  11. php 自动发送邮件的实现
  12. 基于编辑距离来判断词语相似度方法(scala版)
  13. Java中static、final、static final的区别【转】
  14. CssClass="Hidden"和Visible="False"
  15. Java学习---- 数组的引用传递
  16. 一些LinuxC的小知识点(一)
  17. PHP 如何创建守护(daemon)进程
  18. Verilog 位拼接运算符的优先级
  19. SQL索引优化及实战文章总结(总结)
  20. Exchange Powershell:ForwardingAddress&InboxRule

热门文章

  1. js重定向
  2. 爬虫之 Requests库的基本使用
  3. guice基本使用,常用的绑定方式(四)
  4. JavaScript全局函数
  5. JavaScriptResult
  6. Angular CLI 启动 版本ng 4
  7. (转)基于MVC4+EasyUI的Web开发框架经验总结(3)- 使用Json实体类构建菜单数据
  8. (转)Bootstrap 之 Metronic 模板的学习之路 - (6)自定义和扩展
  9. MySQL_基本操作
  10. Ubuntu 16.04 安装python3.6 环境并设置为默认