内容仅供参考,需结合实际需求来处理。
=========SharePoint 环境下运行ps1文件,ps1内容如下=======
Set-ExecutionPolicy ByPass
Add-PSSnapin Microsoft.SharePoint.PowerShell Add-SPSolution -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_Lib.wsp"
Add-SPSolution -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_FilterOfStaffList.wsp"
Add-SPSolution -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_Lookup_ListRelation.wsp" Install-SPSolution -Identity Custom_Lib.wsp -WebApplication http://win2012sp2013:1000/
Install-SPSolution -Identity Custom_WP_FilterOfStaffList.wsp -WebApplication http://win2012sp2013:1000/
Install-SPSolution -Identity Custom_Lookup_ListRelation.wsp -WebApplication http://win2012sp2013:1000/ Update-SPSolution -Identity Custom_ContentType.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_ContentType.wsp" -GACDeployment
Update-SPSolution -Identity Custom_RB_StaffList.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_RB_StaffList.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_RBPermissionOfStaffList.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_RBPermissionOfStaffList.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_SearchStaffList.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_SearchStaffList.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_SeatingPlan.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_SeatingPlan.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_StaffSearch.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_StaffSearch.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_IconandSloganbanner.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_IconandSloganbanner.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_NewAndEvent.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_NewAndEvent.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_DocumentSharing.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_DocumentSharing.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_TrainingCenter.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_TrainingCenter.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_ImageBanner.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_ImageBanner.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_OnlineSurvey.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_OnlineSurvey.wsp" -GACDeployment
Update-SPSolution -Identity Custom_WP_NewsArticles.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_NewsArticles.wsp" -GACDeployment
另外有用的语句:
Uninstall-SPSolution –Identity Clone_List_Scheduler.wsp
Remove-SPSolution -Identity Clone_List_Scheduler.wsp
使用Windows Powershell ISE 64位,附加SharePoint环境的dll
write-host
write-host "Loading PowerShell environment for SharePoint" -foregroundcolor Green
write-host
# unload & load the sharepoint powershell snapin
$snapin = Get-PSSnapin | where-object { $_.Name -eq 'Microsoft.SharePoint.PowerShell' }
if ($snapin -ne $null){
write-host "Unloading SharePoint PowerShell Snapin..." -foregroundcolor Blue
remove-pssnapin "Microsoft.SharePoint.PowerShell"
write-host "SharePoint PowerShell Snapin unloaded." -foregroundcolor Green
}
$snapin = Get-PSSnapin | where-object { $_.Name -eq 'Microsoft.SharePoint.PowerShell' }
if ($snapin -eq $null){
write-host "Loading SharePoint PowerShell Snapin..." -foregroundcolor Blue
add-pssnapin "Microsoft.SharePoint.PowerShell"
write-host "SharePoint PowerShell Snapin loaded." -foregroundcolor Green
}