icinga-powershell-framework/lib/icinga/exception/Get-IcingaLastExceptionId.psm1
Yonas Habteab 9a42c9efa1 Check whether or not a specific wmi class exists
Tests if a specific WMI class including the Namespace can be accessed
and returns status codes for possible errors/exceptions taht might
occure. Returns binary operator values for easier comparison. In case
no errors occured it will return $TestIcingaWindowsInfoEnums.TestIcingaWindowsInfo.Ok
2020-11-05 15:53:44 +01:00

19 lines
469 B
PowerShell

<#
.SYNOPSIS
This function returns the HRESULT unique value thrown by the last exception
.DESCRIPTION
This function returns the HRESULT unique value thrown by the last exception
.OUTPUTS
System.String
#>
function Get-IcingaLastExceptionId()
{
if ([string]::IsNullOrEmpty($Error)) {
return '';
}
[string]$ExceptionId = ([string]($Error.FullyQualifiedErrorId)).Split(',')[0].Split(' ')[1];
$Error.Clear();
return $ExceptionId;
}