Get-KFLastResult

Syntax

Get-KFLastResult
  [-ThrowErrors[:$true]]

Support

>= kenaflow 2.0.0

Return

Nothing.

Description

Many cmdlets from kenaflow return values. These values are output to the PowerShell pipeline. These values can subsequently be queried with the Get-KFLastResult cmdlet.

Furthermore, this cmdlet is used to query error messages from kenaflow cmdlets if a kenaflow cmdlet terminated with an error and the error was not outputted to the PowerShell runtime using the ThrowErrors:$false option.

For example, the following script can be used to check the existence of a user:

Get-KFUserInfo -UserName 'kenaflow' -ThrowErrors:$false
$e = Get-KFLastResult
if( $e -is [System.Exception]) {
Write-Host "User does not exist"
}

If the user "kenaflow" does not exist, then the Cmdlet Get-KFUserInfo does not throw an error which causes the script to exit, but the exception is caught and can be retrieved by Get-KFLastResult. If the user "kenaflow" would exist in this example, the variable $e contains the user object.

Parameters

[-ThrowErrors[:$true]]

This is a default parameter for all kenaflow cmdlets. If set to $true (default!) the engine will pass exception within the cmdlet to the script for further handling.

Example

It's in the description above.