Build: v5.8.192
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.18363.0
I've been able to recreate this issue on a sample form with a single button. Having an issue when exit/break in an IF statement. Used the debugging features, and the error occurs immediately after the Exit statement executes.
Works fine if I run the code in the console, but when I execute as part of a form, I get an error.
Code: Select all
$form1_Load={
#TODO: Initialize Form Controls here
Import-Module ActiveDirectory
}
$button1_Click={
$GetADInfo = Get-ADuser Baloney -Properties Name
IF ($null -ne $GetADInfo)
{
Write-Host "$GetADInfo"
}
Else
{
Write-Host "User: $GetADInfo doesn't exist in Active Directory"
Exit
}
}
Unhandled Exception has occurred in a component in your application. If you click Continue, the application will ignore this error and attempt to continue. System Error.
Error Details are attached to this post.