惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
T
Threat Research - Cisco Blogs
小众软件
小众软件
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Tailwind CSS Blog
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
博客园 - 【当耐特】
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
The Last Watchdog
The Last Watchdog
Simon Willison's Weblog
Simon Willison's Weblog
T
Threatpost
S
Secure Thoughts
O
OpenAI News
P
Proofpoint News Feed
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
Scott Helme
Scott Helme
T
Tenable Blog
A
Arctic Wolf
L
LINUX DO - 热门话题
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
博客园 - Franky
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
博客园_首页
雷峰网
雷峰网
IT之家
IT之家
PCI Perspectives
PCI Perspectives
L
LINUX DO - 最新话题
H
Heimdal Security Blog

博客园 - sumh

用Openxml获取本地文件的扩展信息 用PowerShell批量删除未部署的wsp包 用PowerShell批量收回wsp包 WSS3.0升级到Foundation 2010 PowerShell 操作bcs PowerShell搜索元数据 开发,部署,监视SharePoint 2010的沙盒解决方案 修改MOSS的RTF字段的上传图片功能 高权限的工作流 可重用声明性工作流 站点工作流 工作流事件 可插接式的工作流服务 sharepoint 2010 beta Workflow WF4的新功能 介绍WF4 用Aspx页面做流程表单的一些感想 创建网站集的内容类型 创建Infopath表单数据源的详细步骤图解
用PowerShell批量部署wsp包
sumh · 2011-07-26 · via 博客园 - sumh
 

提供wsp部署的参数:

$wsppath:wsp文件所在的路径,如“c:\”

$wspnames:路径下的所有wsp文件名用逗号隔开,如“sumhtestwsp.wsp,sumhtestwsp123.wsp,sumhtestwsp456.wsp,sumhtestwsp789.wsp”

$allwebapp:是否要全局部署,如“$True”,true是要全局部署$webId:$allwebapp为“$False”,那么就需要输入指定应用程序的Guid

方法:

function deployWSP([string] $wsppath,[string] $wspnames,[bool] $allwebapp,[Guid] $webId)

{

 $PSSnapinSharePoin = Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction silentlycontinue

 if( $PSSnapinSharePoin -eq $Null)

 {

  Add-PSSnapin Microsoft.SharePoint.PowerShell;

 }

 foreach($wspname in $wspnames.split(','))

 {

  $gspsolution = Get-SPSolution -Identity $wspname -ErrorAction silentlycontinue

  if($gspsolution -eq $null)

  {

   Add-SPSolution -LiteralPath $wsppath.Insert($wsppath.Length,$wspname)

  }

  if($allwebapp)

  {

   if(!$gspsolution.Deployed)

   {

    Install-SPSolution -Identity $wspname -GACDeployment -AllWebApplications

   }

  }

  else

  {

   if(!$gspsolution.Deployed)

   {

    Install-SPSolution -Identity $wspname -GACDeployment -WebApplication $webId

   }

  }

 }

}    

例如

deployWSP -wsppath "c:\" -wspnames "sumhtestwsp.wsp,sumhtestwsp123.wsp,sumhtestwsp456.wsp" -allwebapp $true