6

以下内容对我不起作用 -

%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Noninteractive -command "& Invoke-Command -ComputerName "Spider_LT_86" -ScriptBlock { msiexec.exe /i "D:\3PDInstallers\ETLBackgroundWorkerSetup.msi" /qn /l*vx "D:\3PDInstallers\logs" }"

我需要做的就是在远程机器上运行 msiexec。我假设运行脚本的用户需要访问远程机器。

即使计算机名称指向本地计算机,该脚本也不起作用(并且使用相同的登录用户运行 msiexec 可以正常工作,因此看起来不像权限问题) - 我已确保 WinRM 服务正在运行,而且我还禁用了防火墙以检查这是否是问题的原因,但到目前为止还没有运气。我在这里想念什么?

这是完整的错误,但它几乎列出了所有可能性 -

Connecting to remote server failed with the following error message : WinRM cannot process the request. The following error occured while using
Kerberos authentication: The network path was not found.
Possible causes are:
  -The user name or password specified are invalid.
  -Kerberos is used when no authentication method and no user name are specified.
  -Kerberos accepts domain user names, but not local user names.
  -The Service Principal Name (SPN) for the remote computer name and port does not exist.
  -The client and remote computers are in different domains and there is no trust between the two domains.
After checking for the above issues, try the following:
  -Check the Event Viewer for events related to authentication.
  -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.
Note that computers in the TrustedHosts list might not be authenticated.
   -For more information about WinRM configuration, run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting He
lp topic.
    + CategoryInfo          : OpenError: (:) [], PSRemotingTransportException
    + FullyQualifiedErrorId : PSSessionStateBroken

更新:

当我仅使用用户名使用 -Credentials 时,它会弹出一个登录窗口以获取我的密码,然后在输入密码时出现以下错误 - 用户确实具有管理员访问权限,所以我不知道出了什么问题。

[spider_lt_86] 连接到远程服务器失败并显示以下错误消息:访问被拒绝。有关详细信息,请参阅 about_Remote_Troubleshooting 帮助主题。+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionStateBroken

4

3 回答 3

3

这更像是一种解决方法而不是答案,但是当您能够使用 wmi 时,为什么不尝试使用它创建远程进程呢?看看这里http://www.lazywinadmin.com/2011/06/powershell-launchstart-process-on.html?m=1

交换评论后,问题是您没有为远程主机提供具有管理权限的凭据。

于 2013-02-06T17:36:54.597 回答
2

您是否在计算机上设置了 TrustedHosts 以允许您连接到其他计算机?

在您尝试远程访问的计算机上运行此程序。

Set-Item  wsman::localhost\client\TrustedHosts *  
Restart-Service WinRm
于 2013-02-06T17:41:36.787 回答
2

有一点很清楚,错误消息“找不到网络路径”没有说明根本问题是什么。我在Microsoft 论坛上看到了一个帖子,其中一位受访者表示它曾经有效,但现在无效。那是我发现自己的地方。我确认我可以 ping 并且我可以通过网络查看共享,所以我知道网络部分可以正常工作。我重新启动了源服务器,但这似乎没有帮助。一旦我重新启动目标服务器,WinRM 错误就消失了,一切都重新开始工作。目前尚不清楚服务是否出现故障或行为不端,或者是否发生了不太明显的事情。重新启动后,我又遇到了一次失败(大约 20 次尝试),但随机失败在我们的环境中并不少见。

我会把它抛在脑后,以防它帮助别人。

于 2016-09-26T20:06:26.287 回答