I need to find out the VBA code that will open up the login prompt in datalink to connect to the server.
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)
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!
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,
Take a look at this earlier answer to a similar question
Not sure about this one Butch, did you get your coffee when you posted it!
Retrieving data ...