love007 发表于 2012-12-29 11:22:19

使用PowerShell脚本部署定时器到MOSS2010(原创)

<div id="cnblogs_post_body">第一章 前言

在此次练习中,您将了解到如何使用PowerShell和使用SharePoint 2010构建的PowerShell加载项。我这里使用Windows PowerShell ISE来编辑PowerShell命令
第二章 编写命令

在windows7中打开Windows 开始菜单中,打开Windows PowerShell ISE。该快捷方式位于开始菜单-〉所有程序-〉附件-〉Windows PowerShell中。ISE是集成脚本开发环境(Integrated Scripting Environment)的缩写。如下图:

http://pic002.cnblogs.com/images/2012/115581/2012042814484346.png
2.1部署安装命令

打开后键入如下命令:
<div class="csharpcode">#编制时间:忘忧草#编制作用:2012-04-28#编制作用:powershell脚本部署安装定时器到MOSS2010#定时器的解决方案包的名称$TimerJobWSPName = "DotNetFinder.wsp"#定时器的解决方案包所在的路径$TimerJobWSPPath = "C:\MOSS工具\部署安装文档\DotNetFinder.wsp"#定时器的解决方案包的Feature名称(VS解决方案名称+Feature名称)$TimerJobFeatureName = "CustomTimerJob_TimerJobFeature"Write-Host "开始执行卸载服务命令...---------------"Write-Host "第一步:向SharePoint添加解决方案包:" Add-SPSolution -LiteralPath $TimerJobWSPPath #睡眠等待30秒Start-Sleep -s 30Write-Host "添加解决方案包完毕...---------------"Write-Host "第二步:安装解决方案包"Install-SPSolution -Identity $TimerJobWSPName -GACDeployment#睡眠等待30秒Start-Sleep -s 30Write-Host "安装解决方案包完毕...--------------"Write-Host "第三步:激活Feature...--------------"Enable-SPFeature -Identity $TimerJobFeatureName -Url http://moss:8001 #睡眠等待30秒Start-Sleep -s 30Write-Host "激活Feature完毕...--------------"Write-Host "第四步:停用定时器服务...--------------"net stop sptimerv4 #睡眠等待30秒Start-Sleep -s 30Write-Host "停用定时器服务完毕...--------------"Write-Host "第五步:启动定时器服务...--------------"net start sptimerv4#睡眠等待10秒Start-Sleep -s 10Write-Host "启动定时器服务完毕...--------------"Write-Host "执行部署安装命令完毕...--------------"http://images.cnblogs.com/cnblogs_com/love007/201204/20120428144532820.png
页: [1]
查看完整版本: 使用PowerShell脚本部署定时器到MOSS2010(原创)