【问题标题】:Remote Powershell Access denied for certain dll's execution for Sharepoint 2013Sharepoint 2013 的某些 dll 执行被拒绝远程 Powershell 访问
【发布时间】:2013-06-27 14:40:17
【问题描述】:

我正在尝试通过来自构建服务器的远程 powershell 自动执行 sharepoint 2013 部署。一切都按预期执行,除非与 sharepoint dll 中的某些类有关,例如 (Microsoft.SharePoint.Publishing, Microsoft.SharePoint.Publishing.Navigation.WebNavigationSettings)

如果我在本地使用相同的凭据运行相同的脚本,它运行良好。

我考虑过以下几点:

  1. 用户在两台机器上都拥有完全的管理员权限
  2. 在远程服务器上禁用 UAC
  3. 在 thig post (http://social.technet.microsoft.com/Forums/sharepoint/en-US/09b60466-5432-48c9-aedd-1af343e957de/user-cannot-be-found-when-using-invokecommand-newspsite-on-sharepoint) 中遵循了所需的 Remote Powershell 步骤
  4. 我通过注册表默认设置了 powershell 以管理员身份运行 (New-Item -Path "Registry::HKEY_CLASSES_ROOT\Microsoft.PowershellScript.1\Shell\runas\command" -Force -Name '' -Value '"c:\windows\system32\windowspowershell\v1.0\powershell.exe" -noexit "%1"')

脚本代码:

  #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

Remote 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

在此先感谢

【问题讨论】:

  • 实际上是一个快速更新,似乎它的 Sharepoint 在发布站点时拒绝访问其站点。所以我的发现现在指向我的 Sharepoint 是偏执而不是 dll 信任级别。
  • 忘记添加执行发布的用户是共享点农场管理员和站点管理员。当发布在本地发生时,我猜身份验证发生在 sharepoint 上,但是当脚本通过 Remote-Powershell Access denied 运行时抛出异常。

标签: powershell sharepoint-2013 remote-server powershell-remoting


【解决方案1】:

您需要检查 CredSSP 身份验证。使用 SharePoint 执行远程 PowerShell 失败,因为第二个跃点将凭据转换为系统凭据。如果任务涉及查询或更新数据库服务器,它将失败,因为 SYSTEM 帐户将无法访问 SQL Server 上的远程 PowerShell。您需要启用 CredSSP。

查看我不久前写的这篇博文。这并非特定于 SharePoint,但也应适用于您的方案。

http://www.ravichaganti.com/blog/?p=1230

【讨论】:

  • 感谢您的快速回复,我忘了说脚本还有删除站点、重新创建站点、导入 wsp 等其他步骤。它们都工作正常,除了共享点的发布步骤。我知道它使用http,所以身份验证可能在那里丢失了。我遇到了这个博客link,它和我的有类似的问题。尝试弄清楚如何运行“winrm OPERATION”,因为这是我唯一没有执行的操作
猜你喜欢
  • 2017-10-25
  • 2014-06-28
  • 1970-01-01
  • 1970-01-01
  • 2023-03-25
  • 1970-01-01
  • 2021-09-21
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多