[SharePoint 2013] Automatic deployment script
Implement automatic deployment through windows task.
Add-PsSnapin Microsoft.SharePoint.PowerShell $today = Get-Date
$targetDir = $today.ToString("yyyyMMdd")
$executeDir = "folder path"
$executeDir += $targetDir + "\" $webURL = "http://server"
$subject = "Automatic Deployment Finished."
$tos = "xxx@xx"
$body = "Solutions deploy successfully.<br/>"
$errorMsg = ""
$sendingEmail = $true if((Test-Path $executeDir) -eq $true){ $ps1s = Get-ChildItem -Path ($executeDir + "*.ps1") if($ps1s.Count -gt 0){ foreach($ps1 in $ps1s){ Invoke-Expression ($executeDir + $ps1.Name)
} $deployingWSPs = GET-SPSolution | Where-Object {$_.JobExists -eq $true} While($deployingWSPs -ne $null -and $deployingWSPs.Count -gt 0){
Start-Sleep -Seconds 600 $deployingWSPs = GET-SPSolution | Where-Object {$_.JobExists -eq $true}
} $deployingWSPs = GET-SPSolution | Where-Object {$_.Deployed -eq $true -and ($_.LastOperationEndTime - $today).Days -eq 0 -and $_.LastOperationResult.ToString() -like "*Failed*" } if($deployingWSPs -ne $null -and $deployingWSPs.Count -gt 0){
$errorMsg += "Exception occur during deployment, please check in CA.<br/>"
} if($error.Count -gt 0){
$errorMsg += "Exception occure during parse command.<br/>"
$errorMsg += $error[$error.Count - 1].Exception.Message
} if($sendingEmail -eq $true){
$web = Get-SPWeb $webURL
if($errorMsg.Length -gt 0){
$body = $errorMsg
}
[Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web, $true, $false, $tos, $subject, $body) $web.Dispose()
}
}
} exit
[SharePoint 2013] Automatic deployment script的更多相关文章
- SharePoint 2013 Content Deployment 报错 These columns don't currently have unique values
错误描述: These columns don't currently have unique values. Content deployment job 'job name' failed.The ...
- SharePoint 2013 How to Backup Site Collection Automatically With a PowerShell Script
In this post I will introduce a way how to run a script for backing up SharePoint data which could b ...
- Integrating SharePoint 2013 with ADFS and Shibboleth
Time again to attempt to implement that exciting technology, Federation Services (Web Single Sign On ...
- Integrate SharePoint 2013 with Team Foundation Server 2012
Now that SharePoint 2013 is out I want to make sure that I can integrate SharePoint 2013 with Team F ...
- SharePoint 2013 版本功能对比
前言:在SharePoint使用中,经常纠结于版本问题,SharePoint 2013主要有免费的Foundation和收费的标准版.企业版三个版本,他们之间的功能上是不一样的,找了一些资料才发现下面 ...
- SharePoint 2013 扩展查阅项功能
SharePoint 2013的查阅项功能,就是可以扩展其他列表字段为当前列表选项,但是选项太多的时候,会造成选择起来非常麻烦,所以,我们采取JS+Ajax的方式,改善一下这个展示,使操作更加方便. ...
- SharePoint 2013 Excel Services ECMAScript 示例之明日限行
前言:最近遇到一个“明日限行”的功能,北京的交通啊,这个不在今天讨论范围内,暂不吐槽,想想代码开发,还要写WebPart部署,很麻烦,而且部署服务器,需要领导审批,想绕过这个麻烦事儿,就想到客户端了, ...
- 关于在SharePoint 2013(2010)中Javascript如何实现批量批准的自定义操作功能?
1.概述: SharePoint 2013(包括SharePoint 2010)提供了很方便的,多选的界面,但是很多操作还是不能批量进行,比如:批准的功能.如果您要解决方案不关心代码,那么请直接联系作 ...
- [转]安装SharePoint 2013时安装AppFabric失败(错误码:1603)
转自:http://blogs.technet.com/b/praveenh/archive/2013/02/22/sharepoint-2013-prerequisites-fails-with-m ...
随机推荐
- VNC连接远程Ubuntu设置
一.windows 远程软件VNCViewer 这个不多说: 下载地址:http://www.realvnc.com/download/viewer/ 二.安装 vnc-server apt-get ...
- mac
command+R 刷新页面 command+shift+C 我的电脑 finder->应用程序 -> 实用程序 -> 终端 打开 cmd command+F3 显示桌面 comma ...
- python 里面的单下划线与双下划线的区别
python 里面的单下划线与双下划线的区别 Python 用下划线作为变量前缀和后缀指定特殊变量. _xxx 不能用'from moduleimport *'导入 __xxx__ 系统定义名字 __ ...
- 理解callback function in javascript
以下内容主要摘自[1,2] (1)In javascript, functions are first-class objects, which means functions can be used ...
- BC一周年练习赛
Souvenir Accepts: 901 Submissions: 2743 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262 ...
- [转]netty对http协议解析原理
本文主要介绍netty对http协议解析原理,着重讲解keep-alive,gzip,truncked等机制,详细描述了netty如何实现对http解析的高性能. 1 http协议 1.1 描述 标示 ...
- tornado 学习笔记8 模板以及UI
Tornado 包含一个简单.快速而且灵活的模板语言. Tornado同样可以使用任何其他的python模板语言,虽然没有集成这些模板语言进RequestHandler.ren ...
- Jackson学习资料
Jackson JSON Processor Wiki Documentation for the Jackson JSON processor Jackson Tutorial by StudyTr ...
- 一些简单编程练习题P【持续更新】
Q1.写程序将“Hello World”打印到屏幕. A1. public class Test { public static void main(String[] args) { System.o ...
- 【hihoCoder】1033: 交错和
初探数位dp 介绍了数位类统计的基础知识.以下列出其中的基础点: 基本问题 统计在区间[l, r]中满足条件的数的个数 思路 1. [l, r] 将问题转换为 在[0, r]中满足条件的个数 - 在[ ...