簡體   English   中英

Powershell錯誤Add-PSSnapin“ Microsoft.SharePoint.PowerShell”

[英]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"
}

來源: 如何檢查是否安裝了Powershell模塊?

更新:

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM