【问题标题】:Getting exit code 0x80131029, when running powershell through vmware API通过 vmware API 运行 powershell 时获取退出代码 0x80131029
【发布时间】:2020-03-16 12:36:27
【问题描述】:

通过 VMware API 运行 powershell 时,我得到的退出代码为 0x80131029。

有没有办法通过windows log或者其他方法找出这个退出码的原因?

正在使用以下 cmdlet:

获取-WMIObject

获取项目属性

获取-CimInstance

【问题讨论】:

    标签: powershell remote-access vsphere vmware-tools


    【解决方案1】:

    通过以下函数,您可以获得(大部分)这些 HRESULT 值的描述:

    function Resolve-HResult {
        param(
            [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
            [int32[]]$HResult
        )
    
        Process {
            foreach ($hr in $HResult) {
                $comEx = [System.Runtime.InteropServices.Marshal]::GetExceptionForHR($hr)
                if ($comEx) {
                    $comEx.Message
                }
                else {
                    Write-Error "$hr doesn't correspond to a known HResult"
                }
            }
        }
    }
    

    在你的情况下:

    Resolve-HResult 0x80131029
    

    返回

    Process exited due to Timeout escalation.
    

    希望有帮助

    【讨论】:

    • 这是我新的,它也可以在线获得。但造成这种情况的根本原因是什么?我的意思是它是一个短暂的错误。有时它有效,有时则无效。有没有办法找到这个错误的根本原因。
    • @DharmenderLodhi 由于您没有发布任何代码,因此不知道为什么有时会发生超时。
    • 我已经编辑了执行脚本时使用的问题。但奇怪的是,即使我使用“exit 0”执行脚本; .我得到了这个退出代码,我猜即使 powershell 也没有启动。
    猜你喜欢
    • 1970-01-01
    • 2014-04-23
    • 2014-03-03
    • 2023-03-27
    • 1970-01-01
    • 2012-03-05
    • 2017-02-23
    • 2011-09-22
    • 2021-04-17
    相关资源
    最近更新 更多