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. 【MongoDB】C#中的Mongo数据类型转换

    用过Mongo的人都知道,Mongo使用的是Bson类型,有string,int,date,bool等数据类型,具体就不详述了. 在使用Mongo 的C#官方驱动时会碰到一个问题,如何将Bson中的数 ...

  2. java基础(四)

    一.面向对象的三个基本特征: 1.封装,将对象的实现细节隐藏起来,并通过公共接口暴露相关功能: 2.继承,代码复用的表现,当子类继承父类后,子类作为一种特殊的父类,直接获得父类的属性和方法: 3.多态 ...

  3. js常见报错之Unexpected token in JSON at position

    源头   出现这个报错提示,根本原因只有一个--json解析异常,所以请大家直接去关注自己json的返回数据注意检查其返回内容和内容的格式是否正确,至于本文血案的导火索是因为json注释滴问题. 事发 ...

  4. 【maven】maven创建web项目-pom文件提示web.xml is missing and <failOnMissingWebXml> is set to true

    使用maven创建web项目,选择war类型后,pom文件红叉 提示web.xml is missing and <failOnMissingWebXml> is set to true ...

  5. Linux环境下的Nginx编译与安装

    1.新建文件夹: mkdir -p /zuker cd /zuker 2.编译: yum -y install gcc-c++ make wget autoconf libjpeg libjpeg-d ...

  6. 基于socket的客户端和服务端聊天简单使用 附Demo

    功能使用 服务端 分离一个不停接受客户端请求的线程 接受不客户端请求的线程中,再分离就收消息的线程 几大对象分别是 IPEndPoint IP终结点 服务端Socket,绑定终结点Bind,启动监听L ...

  7. Mac iTerm 很好用的终端

    配合Go2Shell使用,效果更佳!我建议你去商店下载它! 先去官网下载软件, 然后可以看看这一篇简明教程. 这里,还有一点点干货也一起带走吧! open -a Go2Shell --args con ...

  8. three.js材质

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xht ...

  9. hihoCoder1388 Periodic Signal(2016北京网赛F:NTT)

    题目 Source http://hihocoder.com/problemset/problem/1388 Description Profess X is an expert in signal ...

  10. Unity Standard Assets 简介之 Vehicles

    这篇介绍载具资源包Vehicles. 主要包含Aircraft(飞行器)和Car(车辆)两部分,两个文件夹里分别有AircraftGuidelines.txt和CarGuidelines.txt对相关 ...