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