check if pssnapin could be load

Welcome Forums General PowerShell Q&A check if pssnapin could be load

Viewing 4 reply threads
  • Author
    Posts
    • #256631
      Participant
      Topics: 2
      Replies: 2
      Points: 34
      Rank: Member

      Hello all,
      I have a multi form project. The mainform has two buttons. In the formload event I like to check when the exchange snapin is installed on the machine show the exchange button, when not hide it. I tried diffrent code, but all what i tried was not successfull. I tested it on the exchange server directly. Hope someone has an idea.
      Here’s the code I have at the moment:

       

    • #256799
      Participant
      Topics: 7
      Replies: 124
      Points: 600
      Helping Hand
      Rank: Major Contributor

      Have you exposed the $buttonExchange variable to a scope where your if statement will have access?

      $[Global]buttonExchange = .....

      or

      $[Script]buttonExchange = .....

    • #256832
      Participant
      Topics: 2
      Replies: 2
      Points: 34
      Rank: Member

      Hi,

      thanks for your replies. If i set both to $true, it is displayed. The snapin will be loaded with another form. I only want to prevent, when the script runs on an other system without the exchange snapin is installed that it is not possible to click it. I’m using PowerShell Studio from SAPIEN. Modified the code since my last post but also no luck. I don’t post the other two functions “CheckExport” and “Checkxml” because this is working.

       

    • #256853
      Participant
      Topics: 7
      Replies: 124
      Points: 600
      Helping Hand
      Rank: Major Contributor

      Although it wont hide the button, setting the Enabled property to $False should ghost/disable it.

    • #256970
      Participant
      Topics: 2
      Replies: 2
      Points: 34
      Rank: Member

      i found the mistake. the correct code should be:

       

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