- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
There is no denying it. Software licensing is a tricky topic. Sometimes, the metric used to calculate software is fairly straight forward. An example of a simple model is Per workstation, which uses one software license right for each installation of the software. Unfortunately, it is not always this easy. Software publishers are constantly creating new and creative ways to license their software to better reflect the value you get from the software. Some models make more sense than others. This can make it increasingly difficult for Software Asset Managers to effectively track software to ensure the organization is compliant for the software.
This post quickly reviews some of the built-in software license calculations in ServiceNow and how to create a new License calculation if one does not exist. This topic is covered in more detail in the ServiceNow Asset Management course. Note that the license calculations used here do not necessarily represent the actual licensing from the software publisher in the example.
For the purpose of demonstration, the software title used here is Adobe Illustrator CC (Creative Cloud). There are nine installations of Illustrator CC in the environment on nine different systems that are assigned to 5 different users. Some users have multiple systems. They are listed here with Model and Form factor displayed for use later in the post.
Per workstation
Per workstation is one of the simplest licensing models simply counts each installation of the software as a right used. Here is a Software Counter that tallies up the rights used in this environment. As expected, nine rights are used because there are nine installations of the software.
Per named user
A License type on the counter of Per named user allows users to have installations on any number of computers, but to only consume one software license right. In this scenario, there are five users of Adobe Illustrator CC. ServiceNow uses the Assigned to field on CI record to identify the user, so this information is important for user based licenses.
Number of installs per user
Some licenses are user based, but limit the number of installations that user can have. For example, a license may allow for each user to have the software installed to two computers and only use a single license right. The License type Number of installs per user performs the count per user. If a user has more than the allotted number of installations, then more rights are used. In this sample, Kathie Argenti has three installations, so she is using two license rights for the software, and the final count reflects this. No other user has more than two installations, so they are each using just a single right.
Custom License Calculations
With new types of license calculations on the rise, you may find that the built-in options do not quite meet your needs. One example that has been brought to my attention several times and most recently on the community, is one that allows users to have two installations, but it has an additional restriction that one of the installs can be on a desktop computer and the other can be on a laptop. If both of the user's installations are on a desktop or both are on a laptop, then the user consumes two software license rights. No default License type in ServiceNow allows for this, so it requires the creation of a custom calculation. Because ServiceNow is flexible, these calculations can be created and shared with other ServiceNow users through Share or the App Store (I am not aware of any custom calculations posted to either of these sites yet, but this could be the start of something).
Note that this example covers some basic things that you might want to do as part of a license calculation, such as determine what has previously been counted for a computer or user. What follows is a breakdown of the process to create a custom calculation to handle this particular situation. It could be modified to support other models, such as Office 365, which also allows multiple installs, but only differentiates between computer and tablet installations.
Software License Calculation Creation
First, you need to create the new License Calculation record.
- Navigate to Software Asset > Reconciliation > License Calculations.
- Click New.
- Name the Calculation. This scenario uses the Software install table and and the software is entitled to the user, so you should use an Entitlement type of User.
Required information
Next comes the tough (but fun!) part: the script to perform the calculation! Before coding, consider the foundation information and how it can be used here and what the process looks like.
Foundation information required:
- Form factor for device - this is best stored on the Model record. Then you can identify it in a single locations for all CIs and Assets based on that model. See Model Extension: Model Management Part 8 for more details on this.
- What has been counted for the user already. This count needs to break up the counted installs by Form factor for the device.
Script flow
Here is the flow that this script takes to perform the calculation.
- Check that the Assigned to field is populated. If not, then automatically count a right used regardless of form factor.
- Check that the Form factor is populated for the Model. If not, then automatically count a right used. This ensures that you show more rights used than you may actually need. You should take appropriate measures to identify Models that need the Form factor to be populated.
- With the Assigned to and Form factor populated, determine the number of installations already counted on desktops and laptops for the user. This uses a GlideAggregate to perform the count.
- With the Desktop and Laptop counts identified, determine the form factor for the current item being counted.
- If the current item is a desktop, determine if there is a desktop right available to the user. In this case, it just means that the number of desktops counted for the user already is lower than the number of laptops.
- If the current item is a laptop, determine if there is a laptop right available to the user. Similar to above, this means there are fewer laptop installations counted for the user than desktops.
- If there is not an available right, then consume a license right for the software.
The code
And now the code itself:
1. Check the Assigned to:
if (!user) {
valuation = 1;
}
2. Check the Form factor:
else if (workstation.model_id.u_form_factor == "") {
valuation = 1;
}
3. Get the count of desktops and laptops already counted for the user.
else {
var desktopCount = 0;
var laptopCount = 0;
var installDesktop = new GlideAggregate(query_table);
installDesktop.addAggregate('COUNT');
installDesktop.addQuery('installed_on.assigned_to', user.sys_id);
installDesktop.addQuery('counted_by.counter', counter_id);
installDesktop.addQuery('cached', true);
installDesktop.addQuery('installed_on.model_id.u_form_factor','Desktop');
installDesktop.setGroup(false);
installDesktop.query();
if (installDesktop.next()) {
desktopCount = installDesktop.getAggregate('COUNT');
}
var installLaptop = new GlideAggregate(query_table);
installLaptop.addAggregate('COUNT');
installLaptop.addQuery('installed_on.assigned_to', user.sys_id);
installLaptop.addQuery('counted_by.counter', counter_id);
installLaptop.addQuery('cached', true);
installLaptop.addQuery('installed_on.model_id.u_form_factor','Laptop');
installLaptop.setGroup(false);
installLaptop.query();
if (installLaptop.next()) {
laptopCount = installLaptop.getAggregate('COUNT');
}
4.1 Desktop rights check.
if (workstation.model_id.u_form_factor == 'Desktop' && desktopCount < laptopCount ) {
valuation = "0";
}
4.2 Laptop rights check.
else if (workstation.model_id.u_form_factor == 'Laptop' && laptopCount < desktopCount ) {
valuation = "0";
}
4.3 Add right used when no rights were already available.
else {
valuation = "1";
}
}
Wrap up
Then when you apply this to the Software Counter, you get the count for each user, but Bertie Luby uses two rights because he has two laptops, and Kathie Argenti uses two rights because she has three computers, two laptops and one desktop. You can
I've attached this full script (commented) as a text file if you want to copy and paste it all at once.
Hopefully this gives you an idea on how to handle complex counters in your environment. What complex counters do you need for your environment? If you are not sure, be sure to reference your agreements or documentation with the software publisher where they identify how to calculate software rights usage.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.