I have an API that returns exit codes of script runs. I save the return object in a variable called $exitCodes.
$exitCodes
will yield an object like this:
@{success=12; error=1; warning=0; unknown=0}
My goal is to be able to tally up the values of each property of $exitCodes without doing something like this:
if ($exitCodes.success + $exitCodes.error + $exitCodes.warning + $exitCodes.unknown -gt 0)
{
do something
}
Is there a way to get the values of each property and add them together without calling each property by name? For this example, assume that every property is going to have a value of the same type.