Invoke-vmscript 无法执行,接收时出现意外错误

Invoke-vmscript fails to execute with unexpected error occurred on a receieve

运行 在 linux 机器上执行以下命令并且失败并出现以下错误:

Invoke-VMScript <<<<  -VM $machine.Name -ScriptType Bash -GuestUser $UserName -GuestPassword $Password -ScriptText $cmd -ToolsWaitSecs 400

错误:

Invoke-VMScript        The underlying connection was closed: An unexpected error occurred on a receive.
    + CategoryInfo          : NotSpecified: (:) [Invoke-VMScript], ViError
    + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript

断开并重新连接到 VI 服务器,这应该可以解决问题。 断开-VIServer -Server * -Confirm:$false -Force Connect-VIServer -服务器 $vcIP -协议 https -用户 $vcUser -密码 $vcPW