某些dll的远程Powershell访问被拒绝';s对Sharepoint 2013的执行
我正试图通过构建服务器上的远程powershell自动化sharepoint 2013部署。除与sharepoint dll中的某些类(如Microsoft.sharepoint.Publishing、Microsoft.sharepoint.Publishing.Navigation.WebNavigationSettings)有关外,所有操作均按预期执行 如果我使用相同的凭据在本地运行相同的脚本,它将正常运行 我已考虑过以下几点:某些dll的远程Powershell访问被拒绝';s对Sharepoint 2013的执行,powershell,sharepoint-2013,remote-server,powershell-remoting,Powershell,Sharepoint 2013,Remote Server,Powershell Remoting,我正试图通过构建服务器上的远程powershell自动化sharepoint 2013部署。除与sharepoint dll中的某些类(如Microsoft.sharepoint.Publishing、Microsoft.sharepoint.Publishing.Navigation.WebNavigationSettings)有关外,所有操作均按预期执行 如果我使用相同的凭据在本地运行相同的脚本,它将正常运行 我已考虑过以下几点: 用户在两台计算机上都具有完全管理员权限 远程服务器上已禁用U
New Item-Path“registry::HKEY\u CLASSES\u ROOT\Microsoft.powershell脚本.1\Shell\runas\command“-Force-Name”“-Value”“”c:\windows\system32\windowspowershell\v1.0\powershell.exe“-noexit”%1“
)将powershell设置为以管理员身份运行 #Set the radio buttons value
$settings = New-Object Microsoft.SharePoint.Publishing.Navigation.WebNavigationSettings (,$rootWeb)
$settings.GlobalNavigation.Source = [Microsoft.SharePoint.Publishing.Navigation.StandardNavigationSource]::PortalProvider
#Set the radio buttons value
$settings.CurrentNavigation.Source = [Microsoft.SharePoint.Publishing.Navigation.StandardNavigationSource]::PortalProvider
write-host "I am here.........................."
$settings.Update()
#Set the Publishing Web
$SPPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($rootWeb)
#Global Navigation Settings
$SPPubWeb.Navigation.InheritGlobal = $false
$SPPubWeb.Navigation.GlobalIncludePages = $false
远程Powershell输出如下所示:
I am here..........................
Exception calling "Update" with "0" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : UnauthorizedAccessException
+ PSComputerName : Contoso-DEVSP
Exception setting "GlobalIncludePages": "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
+ PSComputerName : Contoso-DEVSP
非常感谢您提前检查CredSSP身份验证。SharePoint远程PowerShell执行失败,因为第二个跃点将凭据转换为系统凭据。如果任务涉及查询或更新DB server,它将失败,因为系统帐户将无法访问SQL server上的远程PowerShell。您需要启用CredSSP 查看我不久前写的这篇博文。这并不特定于SharePoint,但也应适用于您的场景
实际上是一个快速更新,它看起来像是Sharepoint在发布网站时拒绝访问其网站。因此,我的发现现在表明Sharepoint是偏执狂,而不是dll信任级别。忘记添加执行发布的用户是Sharepoint场管理员和网站管理员。当发布在本地进行时,我猜sharepoint会进行身份验证,但当脚本通过远程Powershell运行时,会引发拒绝访问异常。感谢您的快速响应,我忘了提到脚本还有其他步骤,例如删除站点、重新创建站点、导入wsp。除了发布sharepoint步骤外,它们都可以正常工作。据我所知,它使用http,因此身份验证可能在那里的某个地方丢失了。我发现这个博客和我的博客有一个相似的问题。试图找出如何运行“winrm操作”,因为这是我唯一没有执行的操作