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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. Integrating SharePoint 2013 with ADFS and Shibboleth

    Time again to attempt to implement that exciting technology, Federation Services (Web Single Sign On ...

  4. 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 ...

  5. SharePoint 2013 版本功能对比

    前言:在SharePoint使用中,经常纠结于版本问题,SharePoint 2013主要有免费的Foundation和收费的标准版.企业版三个版本,他们之间的功能上是不一样的,找了一些资料才发现下面 ...

  6. SharePoint 2013 扩展查阅项功能

    SharePoint 2013的查阅项功能,就是可以扩展其他列表字段为当前列表选项,但是选项太多的时候,会造成选择起来非常麻烦,所以,我们采取JS+Ajax的方式,改善一下这个展示,使操作更加方便. ...

  7. SharePoint 2013 Excel Services ECMAScript 示例之明日限行

    前言:最近遇到一个“明日限行”的功能,北京的交通啊,这个不在今天讨论范围内,暂不吐槽,想想代码开发,还要写WebPart部署,很麻烦,而且部署服务器,需要领导审批,想绕过这个麻烦事儿,就想到客户端了, ...

  8. 关于在SharePoint 2013(2010)中Javascript如何实现批量批准的自定义操作功能?

    1.概述: SharePoint 2013(包括SharePoint 2010)提供了很方便的,多选的界面,但是很多操作还是不能批量进行,比如:批准的功能.如果您要解决方案不关心代码,那么请直接联系作 ...

  9. [转]安装SharePoint 2013时安装AppFabric失败(错误码:1603)

    转自:http://blogs.technet.com/b/praveenh/archive/2013/02/22/sharepoint-2013-prerequisites-fails-with-m ...

随机推荐

  1. Android 应用程序升级到 5.0 需要注意的问题

    Android 5.0,代号 Lollipop,源码终于在2014年12月3日放出,国内一大批厂商跟进.最大的改变是默认使用 ART(Android Runtime) ,替换了之前的 Dalvik 虚 ...

  2. 解决win7下PIL无法打开图片的问题

    找到PIL安装文件里的ImageShow.py 把第99行的 return "start /wait %s && del /f %s" % (file, file) ...

  3. PAT A 1018. Public Bike Management (30)【最短路径】

    https://www.patest.cn/contests/pat-a-practise/1018 先用Dijkstra算出最短路,然后二分答案来验证,顺便求出剩余最小,然后再从终点dfs回去求出路 ...

  4. 移动端使用让图片或者div垂直居中

    ._limgMIiddle{ /* Firefox */ display:-moz-box; -moz-box-pack:center; -moz-box-align:center; /* Safar ...

  5. MyBatis - MyBatis使用log4j2显示sql和结果集

    mybatis-config.xml <settings> <setting name="logImpl" value="LOG4J2" /& ...

  6. 浏览器-04 WebKit 渲染2

    渲染主循环(main loop)和requestAnimationFrame requestAnimationFrame 使用requestAnimationFrame而非setTimeout/set ...

  7. oracle触发器与数据导入导出的简单使用

    exp cjtxx/123456@192.168.80.231/orcl file=d:\cjtxx.dmp owner=cjtxx [tables=tablename] imp cjttest/12 ...

  8. Hdu5093 Battle ships 二分图

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission( ...

  9. php获取实时汇率数据

    支付时常常会用到支付汇率,但汇率数据是实时的,没办法首先设定好,为避免亏损,只能做到实时的了,先推荐个php函数,能实时获取汇率数据.需要curl模块支持. function getExchangeR ...

  10. 2016huasacm暑假集训训练四 _排列

    题目链接:http://acm.hust.edu.cn/vjudge/contest/125308#problem/D 这题要求错误的方式有多少种,就是一个错排公式,记得公式就行            ...