5 Replies Latest reply on Dec 11, 2015 8:58 AM by pthivierge

    VBA code in Datalink to open login Prompt.

    JDW1

      Hi,

       

      I need to find out the VBA code that will open up the login prompt in datalink to connect to the server.

       

      Cheers,

       

      Justin.

        • Re: VBA code in Datalink to open login Prompt.
          Rhys Kirk

          Ideally you do not want to be using PI Logins, instead you should be making use of PI Identities (via PI Mappings) or as a fallback PI Trusts. Unless you are stuck on a pre-380 version of the PI Data Archive..? (You know what the next comment would be if you are...upgrade.)

           

          If you absolutely have to use PI Logins (again, not recommended) then you could do the following:

           

          - Reference PISDK 1.3 Type Library

          - Reference PI-SDK Dialogs

           

          Then use something like the following...

          Dim server As PISDK.server
          Set server = PISDK.Servers("servername")
          
          Dim dlg As New PISDKDlg.Connections
          Set server = dlg.login(server, "pidemo", "", True, True)
          
          1 of 1 people found this helpful
            • Re: VBA code in Datalink to open login Prompt.
              JDW1

              Hi Rhys thanks for the reply. 

               

              I should have worded my original post more clearly.  I need VBA to trigger the Windows Authentication prompt, not the PI Login prompt. ( i.e. the window that pops up when you go to the server list and choose "connect-as".)

               

              Any ideas on how I can do that? ....this is just a temporary work-around until everyone is using 2015 PI and the PI trusts are all set up.

               

              If I can add this via an active x button to run the macro on all the reports currently being used, I thought it'd just be a bit more user friendly?

               

              Cheers for your time though... appreciate it!

                • Re: VBA code in Datalink to open login Prompt.
                  pthivierge

                  Hello Justin,

                   

                  When you select "connect-as" from the login prompt this is the PI Data Archive Explicit Login authentication.

                  So what Rhys provided is correct for what you want to do.

                   

                  In addition to that, you should consider changing this when you upgrade:

                  Explicit logins are the least secure way to authenticate on PI Server. Configure your PI Server for Windows authentication and then disable explicit logins.

                  Source: PI Server System Management

                   

                  Hope this helps,

              • Re: VBA code in Datalink to open login Prompt.
                bpayne

                Take a look at this earlier answer to a similar question