1

I have 3 instances, they all are using one single DB and I want installation ID of all the 3 instances.

I have tried with this, PXLicenseHelper.InstallationID but it returns installation ID of current instance only.

PXLicenseHelper.InstallationID

Is there any way possible using which i can get Installation ID of all the 3 instances at once.

Vivek
  • 13
  • 4

2 Answers2

1

After doing some researches regarding this Installation ID I came to the following:

  1. Acumatica is calculation installation ID base on the InstallationIDBase + PXDatabase.Provider.SchemaCache.DatabaseName. That is visible from the PXDBFeaturedAccessProvider's Installation ID properties getter(shown below).

    // Token: 0x170019A8 RID: 6568
    // (get) Token: 0x06008B0D RID: 35597 RVA: 0x0026A52C File Offset: 0x0026872C
    public override byte[] InstallationID
    {
        get
        {
            return PXCriptoHelper.CalculateSHA(PXLicenseHelper.InstallationIdBase + PXDatabase.Provider.SchemaCache.DatabaseName);
        }
    }
    
  2. The InstallationIDBase is being calculated based on the HostName,UserOfTheProcess,SiteName and ApplicationVirtualPath, this part can be found from PXLicenseHelper's GetBaseInstallationId method(shown below).

    // Token: 0x060092DB RID: 37595 RVA: 0x00290A40 File Offset: 0x0028EC40
    internal static string GetBaseInstallationId(Serilog.ILogger logger, LogEventLevel level)
    {
        string hostName = Dns.GetHostName();
        string userOfTheProcess = PXInstanceHelper.UserOfTheProcess;
        string siteName = HostingEnvironment.SiteName;
        string applicationVirtualPath = HostingEnvironment.ApplicationVirtualPath;
        string installationIdBase = hostName + userOfTheProcess + siteName + applicationVirtualPath;
        if (logger != null && logger.IsEnabled(level))
        {
            logger.ForContext("DnsHostName", hostName, false).ForContext("WindowsUser", userOfTheProcess, false).ForContext("SiteName", siteName, false).ForContext("ApplicationVirtualPath", applicationVirtualPath, false).Write<string>(level, "Base installation ID is {BaseInstallationId}", installationIdBase);
        }
        return installationIdBase;
    }
    

The conclusion is that technically you will always get the problem with getting the UserOfTheProcess if you use different users for IIS Application Pools for each instance. If all your instances are using the same user then the difference should only be in the SiteName and ApplicationVirtualPath which aren't so critical and can be found from the HostingEnvironment.

I hope HB_Acumatica or RuslanDev can add more details to my answer or correct me if I am looking to the wrong part of Acumatica.

Samvel Petrosov
  • 7,580
  • 2
  • 22
  • 46
  • Thanks for the insights Samvel, really appreciate your inputs. I will try to work with your suggestions and will see what I can get with this. – Vivek Aug 09 '19 at 11:04
0

I don't think it is possible from code as the installation id is based on the site.

You would need something from the database to give you that information. You could try to look at the Licensing table at the InstallationID column. I would assume with 3 licensed instances you will have 3 license entries in this table.

If anyone else has some information on this would love to hear it.

Brendan
  • 5,428
  • 2
  • 17
  • 33
  • Thanks for your input Brendan. I tried with the "Licensing" table but there are no records available, maybe I did not applied any license is the reason for that. Any other suggestion will also be highly appreciated. – Vivek Aug 08 '19 at 17:21
  • I don't think there is going to be anything else that will give you the installation IDs. You could search for database field names for InstallationID. You will only have records in the Licensing table when the instance is licensed. Maybe you can add some license records into the table to simulate while testing before using a production environment? but that is my only guess as to watch would work. – Brendan Aug 08 '19 at 17:36
  • Thanks Brendan, I will try this workaround and see what is the outcome I am getting. – Vivek Aug 08 '19 at 18:05