Windows PowerShell Load Form

I am using PS Studio to create what will eventually be a notification window that will first check the expiration date of a user and only prompt the user if their password will expire 6 days or less and then give them an option to change it.

I will package this as an EXE file and want to have a conditional statement to launch first to determine if the the form should load or not.

Basic code.

#if(Statement)
{
Load form1_load

}
else
{
Exit
}

#>

$form1_Load= {
#Notifiy user that their password will change in X Days.

}

I have tried putting a conditional statement just before the form1_Load function and it doesn’t display.

if (2 > 1)
{
    $Form_load
}
{
   Exit
}


$form1_Load= {
#Notifiy user that their password will change in X Days.

}

This doesn’t work.

2 > 1

in Powershell means pipe 2 to 1. :wink: If you want to check if 2 is greater than 1 you have to use

2 -gt 1

get-help about_comparison_operators