Windows PowerShell Load Form

Welcome Forums General PowerShell Q&A Windows PowerShell Load Form

Viewing 2 reply threads
  • Author
    Posts
    • #220368
      Participant
      Topics: 66
      Replies: 71
      Points: 510
      Rank: Major Contributor

      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.

    • #220434
      Participant
      Topics: 4
      Replies: 2247
      Points: 5,484
      Helping Hand
      Rank: Community MVP
      2 > 1

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

      2 -gt 1
    • #220701
      Participant
      Topics: 24
      Replies: 173
      Points: 564
      Helping Hand
      Rank: Major Contributor

      get-help about_comparison_operators

Viewing 2 reply threads
  • You must be logged in to reply to this topic.