我试图通过构建服务器的远程PowerShell自动化SharePoint 2013部署。一切都按预期执行,除非与SharePoint Server中的某些类有关(如Microsoft.SharePoint.Publishing,Microsoft.SharePoint.Publishing.Navigation.WebNavigationSettings)远程Powershell访问被拒绝某些dll执行Sharepoint 2013
如果我在相同的凭据下在本地运行相同的脚本它运行良好。
我已经考虑了以下:
- 用户具有完整的管理权上的远程服务器在两台机器上
- 禁用UAC
- 遵循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)
- 我设置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
提前
其实一个快速更新,好像它的SharePoint发布网站时被拒绝到其站点的访问。所以我的发现现在指向我Sharepoint是偏执而不是信任级别。 –
忘了补充说,执行发布的用户是网站上的共享点Farm管理员和管理员。当发布发生在本地时,我认为身份验证发生在SharePoint上,但是当脚本通过Remote-Powershell运行时,拒绝异常被抛出。 –