How to get the list of activated computers

To retrieve the list of computers that have been activated for a particular ActivationKey, you need to use the QLM Management API.

The QLM License Server provides an extended set of functions that you may want to use for managing your license keys or integrating licensing with any other internal process that you may have. This extended set of functions should typically not be part of your application but rather called from a server or a system that your end-user does not have access to.

Before calling any of the functions below, you need to set the adminEncryptionKey property of the QlmLicense object to the value specified in your Site Properties (Manage Keys tab / Site). If you are developing an application in .NET, it is highly recommended that you obfuscate your code, and more specifically that you encrypt sensitive strings such as the adminEncryptionKey.

The code below assumes you are using the LicenseValidator class which is generated by the "Protect your application" wizard.

private void GetActivatedLicenses (string activationKey)
{
    bool needsActivation = false;
    string errorMsg = string.Empty;
    string table;
    string dataSet = string.Empty;
    string response = string.Empty;
    
    activationKey = activationKey.Replace("-", "");
    string filter = String.Format("ActivationKey='{0}'", activationKey);
     
    LicenseValidator lv = new LicenseValidator();
    lv.QlmLicenseObject.AdminEncryptionKey = "{B6163D99-F46A-4580-BB42-BF276A507A14}"; // replace this as needed
    
    bool ret = lv.ValidateLicense(activationKey, string.Empty, string.Empty, ref needsActivation, ref errorMsg);
    if (ret || needsActivation)
    {
        if (lv.QlmLicenseObject.NumberOfLicenses == 1)
        {
            table = "qryLicenseInfo";
        }
        else
        {
            table = "qryActivationLog";
        }
        lv.QlmLicenseObject.GetDataSetEx(string.Empty, table, filter, ref dataSet, out response);
        DataSet ds = new DataSet("NewDataSet");
        XmlReader reader = new XmlTextReader(dataSet, XmlNodeType.Document, null);
        if (!String.IsNullOrEmpty(dataSet))
        {
            ds.ReadXml(reader);
            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRowCollection drc = ds.Tables[0].Rows;
                if (drc != null)
                {
                    foreach (DataRow dr in drc)
                    {
                        string computerKey = dr["computerKey"].ToString();
                        string computerID = dr["computerID"].ToString();
                    }
                }
            }
        }
    }
}

Last updated