从UNIX通过ssh在Windows上执行电源shell时出错

时间:2016-05-20 15:47:01

标签: windows unix ssh

我试图通过 ssh

从unix触发驻留在Windows服务器上的powershell脚本

SSH命令:

ssh -o StrictHostKeyChecking=no user@server "powershell "D:\\Script\\file\\location\\test.ps1" source_file target_file"

Powershell测试脚本:

param([string]$inputFile, [string]$outputFile)
Write-Host "INPUT: " $inputFile
Write-Host "OUTPUT: " $outputFile
Exit

但是,一旦powershell完成执行,控件就不会返回到unix提示符。 请建议。

1 个答案:

答案 0 :(得分:0)

试试

ssh -o StrictHostKeyChecking=no user@server "echo '\n' |  powershell 'D:\\Script\\file\\location\\test.ps1' source_file target_file"