我试图通过 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提示符。 请建议。
答案 0 :(得分:0)
试试
ssh -o StrictHostKeyChecking=no user@server "echo '\n' | powershell 'D:\\Script\\file\\location\\test.ps1' source_file target_file"