mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
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
19 lines
469 B
PowerShell
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;
|
|
}
|