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

推荐订阅源

P
Proofpoint News Feed
V
V2EX
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
The Cloudflare Blog
T
Tailwind CSS Blog
H
Help Net Security
腾讯CDC
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
D
DataBreaches.Net
C
Check Point Blog
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

博客园 - π三毛

Hyperledge 开发环境配置常见问题 SQL Server 2012日志文件误删除数据库质疑后的相关恢复 go read text file into string array mac boot2docker certs not valid with 1.7 T-SQL 比较N个指段取其中最大值 xcode-git笔记 如何定位Sharepoint网站集所在的w3wp进程 node常用包 Google analytics Offline Installation the .NET Framework 3.5 on Windows 8 [MSDN]How to use the computer keyboard with Windows Phone Emulator turning on full error Messages [转]vi使用方法 转帖-在oracle中自动大批量生成测试数据 删除大恒文档加密客户端 Terminating the Session with ALTER SYSTEM Oracle RMAN vs. Export? 错误14274:无法添加、更新或删除从msx服务器上发起的作业(或其步骤或调度) MS SQL SERVER 2000 同步计算机名称
Managing SharePoint 2010 Farm Solutions with Windows Powe...
π三毛 · 2012-04-17 · via 博客园 - π三毛

http://blog.softartisans.com/2011/01/24/managing-sharepoint-2010-farm-solutions-with-windows-powershell/

Adding solution to the solution store

Prerequisite: None

stsadm

stsadm -o addsolution -filename SampleSolution.wsp

PowerShell

add-spsolution -literalpath c:\solutions\SampleSolution.wsp

Because of the way PowerShell handles file path, the cmdlet’s -literalpath switch only accepts a full path to the WSP file. Using a relative path will result in a File Not Found error.

Deploying solution

Prerequisite: The solution has been added to the solution store.

stsadm

stsadm -o deploysolution -name SampleSolution.wsp -url http://server -allowGacDeployment -force  -immediate

stsadm -o execadmsvcjobs

PowerShell

install-spsolution -identity SampleSolution.wsp -webapplication http://server -gacdeployment -force

This solution contains an assembly which must be registered in Web.config (as a SafeControl), so I use the -url switch with stsadm to specify the location of the desired Web application (to which Web.config belongs); alternatively, I could also use the -allcontenturls switch to deploy to all non-administrative web applications. With PowerShell, the -webapplication switch performs the same purpose.

With stsadm it’s also a good idea to run execadmsvcjobs to ensure that the operation is performed immediately. The cmdlet performs this step automatically.

Upgrading solution

Prerequisite: The solution is currently deployed.

stsadm

stsadm -o upgradesolution -name SampleSolution.wsp -filename SampleSolution.wsp -immediate -allowgacdeployment

stsadm -o execadmsvcjobs

PowerShell

update-spsolution -identity SampleSolution.wsp -literalpath c:\solutions\SampleSolution.wsp -gacdeployment

Again, note that the cmdlet’s -literalpath switch requires a full path to the WSP file.

Retracting solution

Prerequisite: The solution is currently deployed.

stsadm

stsadm -o retractsolution -name SampleSolution.wsp -immediate

stsadm -o execadmsvcjobs

PowerShell

uninstall-spsolution -identity SampleSolution.wsp -webapplication http://server -confirm:$false

As mentioned in the section Deploying solution, the solution requires modification to Web.config. With PowerShell, you must specify with the -webapplication switch the Web application from which the solution is to be retracted. Failure to do so will result in the following error:

Uninstall-SPSolution : This solution contains resources scoped for a Web application and must be retracted from one or more Web applications.

The cmdlet asks you to confirm the operation before proceeding. For a completely automated operation, you can turn off the confirmation with the -confirm switch.

Removing solution from solution store

Prerequisite: The solution has been retracted.

stsadm

stsadm -o deletesolution -name SampleSolution.wsp -override

PowerShell

remove-spsolution -identity SampleSolution.wsp -confirm:$false