2 down vote favorite
When executing an Invoke-Command on ServerA it starts executing on ServerB but the script halts on a Test-Path where is directory it is checking for exist on ServerB: I have tried passing my admin domain credential across but this has had no affect.
I have 2 Win 2008 R2 servers in the same domain. ServerA is the client executing remote powershell commands, serverB is the server being asked to execute a powershell script locally on it. I have also tried this in an Interactive PSSession with the same results.
Both servers have enabled powershell remoting
Both servers have configured winrm (winrm quickconfig)
Both servers have TrustedHosts set to *
Both servers have FireWall turned off
Both servers have PowerShell 3.0
$remote=New-PSSession -ComputerName $DeployHost -Credential $Cred
Invoke-Command -ComputerName $DeployHost -ScriptBlock $DeployCmdResources -ArgumentList $AppName, $CodeVersion
Error being sent back during the script execution on ServerB
*** Beginning Installation ***
Test-Path : Access is denied
At F:\DeploymentScripts\deploy-SIDEA.ps1:367 char:8
+ if (!(Test-Path $passdir -pathType "Container"))
+ CategoryInfo : NotSpecified: (:) [Test-Path], UnauthorizedAccessException