0

我建立了一个持久会话,然后尝试使用以下行远程执行脚本:

Invoke-Command -Session $Session  -FilePath "FullStopBizTalkApp.ps1"  -argumentlist $BizTalkMgmtDBConString, $ApplicationNameInBizTalk

如果我然后执行: $_.Exception.ToString() 我可以看到以下错误:

System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\tfs_service\FullStopBizTalkApp.ps1' because it does not exist.

使用 -ScriptBlock 时,我能够从同一个客户端调用命令到同一个目标服务器,我只在使用 -FilePath 时遇到问题

有任何想法吗?

4

2 回答 2

2

输入脚本的路径和文件名,或者确保您的会话工作目录是脚本文件的父目录。

于 2012-09-18T14:44:06.843 回答
0

I was looking at this too long!

The error was relating to the local path of the file before it was copied to target server. I fixed this by changing the value for the -FilePath argument

于 2012-09-18T14:51:15.293 回答