How to Solve the Powershell Remoting Double-Hop Issue with Constrained Delegation?

0
13
Asked By CoolCat42 On

Hey everyone! I'm facing a challenge while trying to use PowerShell remoting with constrained Kerberos delegation. I've set up a test environment with a Domain Controller (mydom.corp), two member servers (winrm1 and winrm2), and a client to run my tests. When I run the following commands separately, everything works fine:
1. Invoke-Command -ComputerName winrm1.mydom.corp -ScriptBlock { hostname }
2. Invoke-Command -ComputerName winrm2.mydom.corp -ScriptBlock { hostname }
However, when I try to invoke winrm2 from winrm1 using this command, I keep hitting the 0x8009030e error:
Invoke-Command -ComputerName winrm1.mydom.corp -ScriptBlock { Invoke-Command -ComputerName winrm2.mydom.corp -ScriptBlock { hostname } }
I followed the guidelines from the Microsoft documentation on this topic, but I'm not getting any luck with constrained delegation. Has anyone successfully set this up?
Thanks in advance for your advice!

5 Answers

Answered By ScriptKing22 On

Constrained delegation can be tricky. It typically requires that the entity performing the authentication on the first hop needs to be the one granted permission to delegate. I recommend testing out access to resources like SMB shares for simplicity. You can set it up with:
`Set-ADComputer host1.domain.com -Add @{'msDS-AllowedToDelegateTo' = @('cifs/host2')}` and ensure that all relevant SPNs are configured on your accounts.

Answered By CommandMaster88 On

You might just need to pass credentials directly. You can modify your script block to include a Credential parameter for the second hop. Something like this should work:
`$Credential = Get-Credential; Invoke-Command -ComputerName winrm1.mydom.corp -ScriptBlock { Invoke-Command -ComputerName winrm2.mydom.corp -ScriptBlock { hostname } -Credential $using:Credential }`.

Answered By TechWhiz99 On

From what I gathered from the docs, make sure to set the correct delegation permissions. You might want to try granting resource-based Kerberos constrained delegation with a command like:
`Set-ADComputer -Identity $ServerC -PrincipalsAllowedToDelegateToAccount $ServerB`. Also, check if your user account has the delegation rights:
`Set-ADUser -Identity "username" -TrustedForDelegation $true`. Don’t forget to use `-Authentication Kerberos` on your Invoke-Command as well.

Answered By DevGuru25 On

This double-hop issue is quite annoying! If the current setup doesn’t work, you might try using CredSSP or fall back to unconstrained delegation as a temporary fix. A lot of us have been in the same boat, unfortunately.

Answered By PowerShellNinja77 On

Honestly, I would just connect directly to your second server instead of going through the first. It simplifies things significantly and avoids the double-hop problem. But if you need to stick with delegation, consider using CredSSP, though it’s not typically preferred.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.