You are viewing limited content. For full access, please sign in.

Question

Question

LFDS SDK to Update Hardware Fingerprint

asked on April 14, 2022

Hello. We have a scenario where the VM server that hosts the Laserfiche servers are upsized/downsized at the end of the month. This causes a change in the hwfp and the customer has to update the new hwfp for each server instance. We looked through the documentation for the LFDS SDK, but didnt see anything that would allow us to use the LFDS SDK. Is this supported in the LFDS SDK? If yes, can someone provide some code on how to get it done. Thank you for your time.

0 0

Answer

SELECTED ANSWER
replied on April 15, 2022 Show version history

Here's a basic example of how to update the HWFP of a registered host (application server) and then print the license for a given app using LMO. (This will update the HWFP for all apps registered on that host.) Let me know if you need more help!

using (Server s = Server.Connect("myLfdsMachine.domain.com", false))
{
	// Update hardware fingerprint for app server
	Database db = s.GetDatabaseByRealmName("myLicensingSiteName");
	db.LoginWindows();

	int LookupHostIdByName(string hostName)
	{
		List<Host> hosts = db.GetAllHosts();

		foreach (var host in hosts)
		{
			if (host.Name == hostName)
			{
				return host.ID;
			}
		}

		return -1;
	}

	var appServerHostName = "myAppServer.domain.com";

	Host readHost = db.GetHost(LookupHostIdByName(appServerHostName));
	readHost.Fingerprint2 = "myNewFingerprint";
	readHost.Update();


	// Print new license for a given app
	Guid applicationId = new Guid("myLaserficheApplicationGuid");

	Version version = null;
	byte[] licBytes;

	Application application = db.GetRegisteredApplication(applicationId);
	version = application.Version;
	licBytes = application.GetLicense(null, LicenseType.Xml);

	string result = System.Text.Encoding.UTF8.GetString(licBytes);

	Console.WriteLine(result);
}

 

0 0

Replies

replied on April 14, 2022

Hi Joseph,

My first thought is, have you considered using domain licensing instead? This would allow you to license both LFDS and end apps using a domain instead of a hardware fingerprint, which would sidestep the changing HWFP issue. Otherwise, the LFDS SDK can do the HWFP changing and license downloading for you (anything you can do in the web interface, the SDK can do)

0 0
replied on April 14, 2022

Chase,

    Thank you for the response. I will ask the customer about the domain license option. However, could you provide any additional sample syntax how to update the hwfp in the LFDS SDK. Thanks!

0 0
SELECTED ANSWER
replied on April 15, 2022 Show version history

Here's a basic example of how to update the HWFP of a registered host (application server) and then print the license for a given app using LMO. (This will update the HWFP for all apps registered on that host.) Let me know if you need more help!

using (Server s = Server.Connect("myLfdsMachine.domain.com", false))
{
	// Update hardware fingerprint for app server
	Database db = s.GetDatabaseByRealmName("myLicensingSiteName");
	db.LoginWindows();

	int LookupHostIdByName(string hostName)
	{
		List<Host> hosts = db.GetAllHosts();

		foreach (var host in hosts)
		{
			if (host.Name == hostName)
			{
				return host.ID;
			}
		}

		return -1;
	}

	var appServerHostName = "myAppServer.domain.com";

	Host readHost = db.GetHost(LookupHostIdByName(appServerHostName));
	readHost.Fingerprint2 = "myNewFingerprint";
	readHost.Update();


	// Print new license for a given app
	Guid applicationId = new Guid("myLaserficheApplicationGuid");

	Version version = null;
	byte[] licBytes;

	Application application = db.GetRegisteredApplication(applicationId);
	version = application.Version;
	licBytes = application.GetLicense(null, LicenseType.Xml);

	string result = System.Text.Encoding.UTF8.GetString(licBytes);

	Console.WriteLine(result);
}

 

0 0
replied on April 18, 2022

Chase,

    Thank you for your response. Have a good day!

Joe

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.