powershell - Can Invoke-Command be used to call Invoke-Command on a third system? -
i've got segmented active directory network multiple vlan's can talk local ad server, ad servers can talk each other. i'd have script can proxy through each ad server run command on each system per vlan. however, code doesn't appear run commands.
function runremote { param([string]$scriptblock,[string]$server,[string]$dc) $icm = '[scriptblock]$sb=[scriptblock]::create(' + $scriptblock + ');icm -cn ' + $server + ' -scriptblock $sb' icm -cn $dc -scriptblock { $icm } } $scriptblock = "date" $server = "comp01" $dc= "dc01" runremote $scriptblock $server
i'm not receiving errors, none of commands sent being run on remote servers. if make interactive session ad server, invoke command works expected each vlan.
i think have dubble hop problem. you're credentials aren't passed next hop. can send you're credentials first invoke parameters , in second invoke use passed credentials make credential object , give credential parameter.
or can use credssp.
Comments
Post a Comment