0

我试图通过构建服务器的远程PowerShell自动化SharePoint 2013部署。一切都按预期执行,除非与SharePoint Server中的某些类有关(如Microsoft.SharePoint.Publishing,Microsoft.SharePoint.Publishing.Navigation.WebNavigationSettings)远程Powershell访问被拒绝某些dll执行Sharepoint 2013

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

我已经考虑了以下:

  1. 用户具有完整的管理权上的远程服务器在两台机器上
  2. 禁用UAC
  3. 遵循THIG岗位所需的远程PowerShell步骤(http://social.technet.microsoft.com/Forums/sharepoint/en-US/09b60466-5432-48c9-aedd-1af343e957de/user-cannot-be-found-when-using-invokecommand-newspsite-on-sharepoint
  4. 我设置powershell作为管理员通过注册表的defualt运行(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 

的远程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 

提前

+0

其实一个快速更新,好像它的SharePoint发布网站时被拒绝到其站点的访问。所以我的发现现在指向我Sharepoint是偏执而不是信任级别。 –

+0

忘了补充说,执行发布的用户是网站上的共享点Farm管理员和管理员。当发布发生在本地时,我认为身份验证发生在SharePoint上,但是当脚本通过Remote-Powershell运行时,拒绝异常被抛出。 –

回答

0

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

检查这篇博文是我前一段时间写的。这不是特定于SharePoint,但它也应该适用于您的方案。

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

+0

感谢您的快速响应,我忘了提及脚本还有其他步骤,例如删除站点,重新创建站点,导入wsp。除了发布分享点步骤外,它们都工作正常。我知道它使用http,所以可能认证在某处丢失。我遇到了这个博客[链接](http://social.technet.microsoft.com/Forums/sharepoint/en-US/7d5dfa83-71ba-4dd4-8a3f-543b64ba0a55/powershell-remoting-access-denied-with-sharepoint - 命令),这与我的问题类似。 TryingFigure out如何运行“winrm操作”,因为这是我没有执行的唯一的事情 –