2

I am getting exit code as 0x80131029 when running powershell through VMware API.

enter image description here

Is there anyway I can find out the reason for this exit code through windows log or any other method?

Following cmdlets are being used:

Get-WMIObject

Get-ItemProperty

Get-CimInstance

1 Answers1

1

With below function you can get (most of) the descriptions for these HRESULT values:

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"
            }
        }
    }
}

In your case:

Resolve-HResult 0x80131029

returns

Process exited due to Timeout escalation.

Hope that helps

Theo
  • 57,719
  • 8
  • 24
  • 41
  • This I new, it is available online also. But what is the root cause for this? I mean it is coming as a transient error. Sometimes it works and sometimes it doesn't. Is there any way to find the root cause of this error. – Dharmender Lodhi Mar 17 '20 at 08:28
  • @DharmenderLodhi Since you didn't post any code, there is no telling why the timeouts sometimes happen. – Theo Mar 22 '20 at 11:39
  • I have edited the question which are being used while executing the script. But strange thing is, even if I execute script with "exit 0;" . I am getting this exitcode, I am guessing even the powershell isn't starting. – Dharmender Lodhi Mar 24 '20 at 04:28