使用服务帐户拒绝访问

时间:2015-01-16 15:03:33

标签: powershell

我正在尝试从MachineB在远程MachineA上运行一些NLB命令,并且在使用服务帐户时我收到Access被拒绝错误。当我以帐户身份运行时,该命令运行正常。

最初从本地计算机运行命令时,我也无法运行命令。我得到了同样的错误。即使我能够做Enter-PSSession并运行简单的命令。但在完成guide后,我能够为我的帐户解决这个问题。这是一个双跳问题。

现在我不知道为什么服务帐户不会执行这些命令。

$userName = "domain\account"
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $userName, $password
$Session = New-PSSession -ComputerName MachineA -Credential $Credential -Authentication Credssp
Invoke-Command -Session $Session -ScriptBlock { 

    Import-Module NetworkLoadBalancingClusters
    Get-NLBClusterNode MachineA
    } 
}

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    + CategoryInfo          : PermissionDenied: (Microsoft.Netwo...tNlbClusterNode:GetNlbClusterNode) [Get-NlbCl 
   usterNode], UnauthorizedAccessException
    + FullyQualifiedErrorId : AccessDenied,Microsoft.NetworkLoadBalancingClusters.PowerShell.GetNlbClusterNode
    + PSComputerName        : ComputerName

其他信息: 服务帐户是计算机上的管理员。我在事件日志中看不到任何错误。当服务帐户登录时,我在事件日志中看到

 Detailed Authentication Information:
                         Logon Process:        Kerberos
                         Authentication Package:    Kerberos
                         Transited Services:    -
                         Package Name (NTLM only):    -
                         Key Length:        0

当我执行Get-WSMANCredSSP时,它会给我以下输出。这允许我使用我的个人帐户进行invoke-command。

    PS C:\Windows\system32> Get-WSManCredSSP
    The machine is configured to allow delegating fresh credentials to the following target(s): wsman/machinenameB
    ,wsman/fullyqualifiedmachinenameB,wsman/machinenameB
This computer is configured to receive credentials from a remote client computer

其他信息: 我发现帐户类型是活动目录用户和计算机工具中的用户。用户属性上没有委托选项卡。这可能是一个问题吗?

1 个答案:

答案 0 :(得分:0)

问题是用户不是我们NLB环境中某个clusterNodes的管理员。在做NLB时我没有密切注意的是当你使用PowerShell远程访问任何clusterNode时,即使你没有远程连接到那些其他服务器,该帐户也必须是所有节点上的管理员。因此,虽然帐户是一台服务器上的管理员,但它不在其中一个服务器上,所以它失败了这个错误。