I am struggling for a while with using variable with pscp command.
ForEach ($Server in $Servers)
{
.\pscp.exe -pw $password create_ssh $myUsername@$Server:/home/$myUsername/create_ssh
.\plink.exe -pw $password $myUsername@$Server -C "uname -r"
}
Output
Local to local copy not supported
2.6.32-573.1.1.el6.x86_64
When I try to specify hostname not using variable there isnt any issue with transferring of the file. However If I try to use variable $Server, I get an error "Local copy not supported" I thought it might be problem with variable itself but .\plink works without any issues
I have tried to use commas, escape @, full paths etc. nothing seems to be working. I cant use winscp.dll since in this specific case I need automatically accept host keys (which is insecure but really specific only to this case) - this is only provided by pscp.
Thanks a lot!