Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

SharePoint 解決方案部署、收回、刪除:STSADM 與 PowerShell 指令速查表

編輯:系統常見問題解答

頻繁部署 WSP 解決方案時,整理常用指令備查。SharePoint 2010 仍支援 STSADM,但官方建議改用 PowerShell,功能更強、效能更好、不區分大小寫,且必須以管理員身分在 SharePoint 伺服器上執行。

STSADM 指令

stsadm -o addsolution -filename c:\bin\CustomerSiteSearch.wsp
stsadm -o deploysolution -name CustomerSiteSearch.wsp -url https://[ServerName] -allowgacdeployment -force -immediate
stsadm -o activatefeature -name customersitesearch_feature1 -url https://[ServerName] -force
stsadm -o retractsolution -name solutionName.wsp -immediate
stsadm -o deletesolution -name solutionName.wsp

PowerShell 指令(推薦)

Add-SPSolution c:\bin\CustomerSiteSearch.wsp
Install-SPSolution -Identity CustomerSiteSearch.wsp -AllWebApplications -GACDeployment
Enable-SPFeature CustomerSiteSearch_feature1 -url https://[ServerName]/ -force
Uninstall-SPSolution -Identity solutionName.wsp
Remove-SPSolution -Identity solutionName.wsp

關鍵差異提醒

項目STSADMPowerShell
大小寫敏感是否
管線支援無完整物件管線
錯誤處理回傳碼/文字豐富例外物件
模組化單一執行檔模組化 Cmdlet
官方建議已棄用標準工具

最佳實踐:新腳本一律使用 PowerShell;舊有 STSADM 腳本可逐步遷移。部署前請備份內容資料庫,並在測試環境驗證。

Copyright © Windows教程網 All Rights Reserved