简体   繁体   English

Powershell错误Add-PSSnapin“ Microsoft.SharePoint.PowerShell”

[英]Powershell error Add-PSSnapin “Microsoft.SharePoint.PowerShell”

I am getting an error when I run below command from sharepoint 2010 managment shell using admin rights. 当我使用管理员权限从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

Check to see if module is already loaded: 检查模块是否已经加载:

if (Get-Module -ListAvailable -Name SomeModule) {
  Write-Host "Module exists"
} else {
  Write-Host "Module does not exist"
}

Source: How do I check if a powershell module is installed? 来源: 如何检查是否安装了Powershell模块?

UPDATED: 更新:

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.

相关问题 Add-PSSnapin'Microsoft.SharePoint.PowerShell'在ISE中运行,但不是从.Net Process.Start命令运行 - Add-PSSnapin 'Microsoft.SharePoint.PowerShell' runs in ISE but not from .Net Process.Start command 此计算机上未安装PSSnapin Microsoft.Sharepoint.Powershell - PSSnapin Microsoft.Sharepoint.Powershell is not installed on this computer 如何解决Add-PSSnapin Microsoft.TeamFoundation.PowerShell和Get-TfsChildItem错误? - How to resolve the Add-PSSnapin Microsoft.TeamFoundation.PowerShell and Get-TfsChildItem error? 无法将pssnapin microsoft.exchange.management.powershell.admin添加到Powershell Studio脚本 - Unable to add-pssnapin microsoft.exchange.management.powershell.admin to powershell studio script 来自高级(cmdlet)函数的PowerShell Add-PSSnapIn - PowerShell Add-PSSnapIn from an advanced (cmdlet) function Linux Powershell客户端:Add-PSSnapin VeeamPSSnapIn和Connect-VBRServer - Linux Powershell client : Add-PSSnapin VeeamPSSnapIn & Connect-VBRServer 将-ea与Add-PSSnapin一起使用时Powershell停止工作 - Powershell stops working when using -ea with Add-PSSnapin Powershell Add-PSSnapin VMWare.VimAutomation.Core问题 - Powershell Add-PSSnapin VMWare.VimAutomation.Core issues 此计算机上未安装 Windows PowerShell 管理单元“Microsoft.Sharepoint.Powershell”? - Windows PowerShell snap-in 'Microsoft.Sharepoint.Powershell' is not installed on this computer? 从C#运行PowerShell脚本时,Add-PSSnapin的路径不正确 - Path for Add-PSSnapin not correct when running PowerShell Script from C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM