WINRM credentials in remote script block not working as expected

0

I am trying to use WINRM to connect to one host (in the internal domain) and then from there WINRM into another server in another domain (the DMZ). Below is an example:

$domainServer = 'DOMAINSERVER'
$dmzServer = 'DMZSERVER'
$domainCred = Get-Credential -Message "Enter domain creds"
$dmzCred = Get-Credential -Message "Enter dmz creds"

Invoke-Command -ComputerName $domainServer -ArgumentList $dmzServer,$dmzCred -ScriptBlock {
    Write-Host "connected to $domainServer"
    Invoke-Command -ComputerName $args[0] -ScriptBlock {
        Write-Host "connected to $args[0]"
    } -Credential $args[1]
} -Credential $domainCred

However when I try this I am getting this error:

[DMZSERVER] Connecting to remote server DMZSERVER failed with the following error message : WinRM cannot process the request. The 
following error with errorcode 0x80090311 occurred while using Kerberos authentication: There are currently no logon servers available to service the 
logon request.

I am able to open a WINRM session from DOMAINSERVER to DMZSERVER if I log on to DOMAINSERVER and open a console and try there, so the problem is something with my nested "invoke-command"

powershell
winrm

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0