Asserts that the last process succeeded by checking PowerShell's $LastExitCode
automatic variable.
Assert-LastProcessSucceeded [[-Message] <String>] [<CommonParameters>]
A process succeeds if $LastExitCode
is zero.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Message | String | The message to show if the assertion fails. |
false | false |
Assert-LastProcessSucceeded
Demonstrates how to assert that the last process succeeded.
Assert-LastProcessSucceeded 'cmd.exe'
Demonstrates how to show a custom message when the assertion fails.