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. windows下编译及使用libevent

    Libevent官网:http://libevent.org/ windows 7下编译: 编译环境: windows 7 + VS2010 (1)解压libevent到F:\libevent\lib ...

  2. Python学习笔记(五)——list和tuple

    一.list 1.定义: list是一种有序的集合,可以随时添加和删除其中的元素 2.声明方法: subjects=['Math','English', 'Chinese'] 3.一些api (1)获 ...

  3. ubuntu14.0.4.3 devstack 安装openstack

    参考网址: http://www.chenshake.com/install-ubuntu-14-04-devstack/ 现在装完一切正常,就是不能重启,一旦重启VM,会导致给br-ex设置的IP地 ...

  4. Delphi 操作Flash D7~XE10都有 导入Activex控件 shockwave

    http://www.cnblogs.com/devcjq/articles/2906224.html Flash是Macromedia公司出品的,用在互联网上动态的.可互动的shockwave.它的 ...

  5. Delphi文件操作函数

    文件是同一种类型元素的有序集合,是内存与外设之间传输数据的渠道.文件的本质是一个数据流,所有的文件实际上是一串二进制序列.文件管理包括:1.文件操作.2.目录操作.3.驱动器操作.三部分. 1.常见文 ...

  6. 我的c++学习(10)this指针

    问题:当在对象的外部访问该对象的公有成员时,必须指明是哪一个对象.但是当我们用对象的成员函数来访问本对象的成员时,在成员函数中只要给出成员名就可以实现对该对象成员的访问.再进一步可用同一个类创建很多个 ...

  7. Linux 小命令

    查看 cat  文件名     [查看里面的内容,cate,猫,像猫一样瞄一眼的看] more 文件名   [查看文件,文件太多,一次看不完,用 more 来查看 下一页:空格或 f   下一行:回车 ...

  8. spring异常-aoperror at :0 formal unbound in pointcut

    八月 17, 2016 10:15:21 上午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRe ...

  9. Python for Infomatics 第12章 网络编程五(译)

    注:文章原文为Dr. Charles Severance 的 <Python for Informatics>.文中代码用3.4版改写,并在本机测试通过. 12.8 用urllib读取二进 ...

  10. 搭把手教美工妹妹如何通过升级SSD提升电脑性能

    -----by LinHan 不单单适用于妹子,我这名的意思的妹子也能看懂. 以下教程依据实践和部分互联网资料总结得出,向博客园, CSDN的前辈们致谢:同时,如有说的不正确或有不到位的地方,麻烦指出 ...