【发布时间】:2015-06-17 14:20:35
【问题描述】:
我已经成功让 winrm 工作,我可以在 shell 中运行 Enter-PSSession my-machine 并随后输入命令。但是,当我尝试运行启动远程会话的脚本时,所有后续调用都在本地计算机上运行。例如:
PS> test.ps1
test.ps1 的内容
Enter-PSSession remote-pcname
gc env:computername
打印出local-pcname 而不是remote-pcname 知道为什么脚本文件不支持远程会话吗?它肯定是成功连接,因为当脚本完成时,我会返回到远程机器的 shell 提示符。
【问题讨论】:
标签: powershell powershell-2.0 powershell-remoting