[英]Add-PSSnapin 'Microsoft.SharePoint.PowerShell' runs in ISE but not from .Net Process.Start command
[英]Powershell error Add-PSSnapin “Microsoft.SharePoint.PowerShell”
當我使用管理員權限從sharepoint 2010管理shell運行以下命令時,出現錯誤。
Add-PSSnapin Microsoft.Sharepoint.Powershell
Add-PSSnapin : Cannot add Windows PowerShell snap-in Microsoft.Sharepoint.Power
shell because it is already added. Verify the name of the snap-in and try again
檢查模塊是否已經加載:
if (Get-Module -ListAvailable -Name SomeModule) {
Write-Host "Module exists"
} else {
Write-Host "Module does not exist"
}
更新:
Try {
if((Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null){
Add-PsSnapin Microsoft.SharePoint.PowerShell
}
}Catch{
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.