Open navigation

Creating ThinPrint license reports

Automatic Reporting of License Usage

Technical Requirements

Enable the feature

Creating a report file manually

    Contents of the report file

    Domain remains anonymous

    Stylesheet

    Convert XML format into a readable form

Summary


Note! As a ThinPrint service provider you have the availability, as of License Server version 10.6 (and later), for automatic assignment of ThinPrint licenses to users. So users can be automatically assigned a license immediately, the first time they print.

This facility offers greatly simplified license administration and provides for accurate bill­ing from ThinPrint, based on actual usage. These are both big advantages, especially in environments with fluctuating user numbers.

In addition, you can still assign licenses to users and user groups manually (for example, when importing from Microsoft Active Directory) or you can make exclu­sions from the automatic license allocation.

Billing from ThinPrint to you as a service provider is based on monthly reports, wherein your ThinPrint clients remain anonymous. As the service provider, you can also create a second internal report in which you can view the assignment of licenses for your individual clients. This report enables you in turn, to accurately bill clients, based on usage.

This document explains how these report files, that identify the active users, can be generated automatically.


Automatic Reporting of License Usage

With ThinPrint License Server 13.1.6 comes a new way of automatically reporting license usage for service providers. The service will automatically generate and send the report to ThinPrint every 2 days.


Technical Requirements

  • ThinPrint License Server 13.1.6
  • Internet access via port 443 (outbound connection)
    • at least lsus.thinprint.com/lsus/reports need to be reachable

Enable the feature

The feature is disabled by default and has to be enabled in the Windows Task Scheduler.

Enabling Automatic Reporting


Creating a report file manually

With License Server version 10.6 (and later), it is possible to create a report file from the command line. To do so, go to the appropriate directory on the license server. By default, the command is in the following directory:

C:\Program Files\Common Files\ThinPrint

  • Start the command line with administrative rights. The invoked command is:
cclucs.exe -report [FILE]

[FILE] is the path and file name. Example:

cclucs.exe -report c:\temp\ThinPrintLicenseReport.xml

generate a report file of the ThinPrint license server using the command line

The file suffix type is arbitrary. But the content is always created as XML. So it is advisable to select XML as the format.


Contents of the report file

The file contains a signature at the end, to verify it to ThinPrint. For further processing or to import the file into other applications for internal use, the signature may need to be removed (arrow).

Contents of the ThinPrint report file

Domain remains anonymous

The domain is visible only as SID and is thus made anonymous to ThinPrint. For internal purposes, you can determine the actual names of the respective domains, using tools such as PSGetSID from Sysinternals.

For internal purposes, you can determine the actual names of the respective domains, using tools such as PSGetSID from Sysinternals


Stylesheet

A better laid out display can be created using, for example, the Transform function in Excel. For this purpose, a suitable stylesheet must be created (in this example: ThinPrintLicenseReport.xsl):

<?xml version='1.0'?> 
<xsl:stylesheet version="1.0" xmlns:xsl="https://www.w3.org/1999/XSL/Transform"> <xsl:template match="/">  
<html>  
<body>    
<table border="2" bgcolor="yellow">      
    <tr>        
        <th>Domain</th>        
        <th>Date</th>        
        <th>UserCount</th>      
    </tr>       

<xsl:for-each select="LicenseReport/Product/Domain[@DomainSid!='S-1-5-32']">      
    <tr>        
        <td>
            <xsl:value-of select="@DomainSid"/>
        </td>        
        <td>
            <xsl:value-of select="@Date"/>
        </td>        
        <td>
            <xsl:value-of select="@UserCount"/>
        </td>      
    </tr>      

</xsl:for-each>    
</table>  
</body>  
</html> 
</xsl:template> </xsl:stylesheet>

 

Convert XML format into a readable form

Using PowerShell script the original report file in XML format can then be converted into a visually more readable form (in this example: ThinPrintLicenseReport.ps1):

param ($xml, $xsl, $output)
if (-not $xml -or -not $xsl -or -not $output)
{
Write-Host "& .\xslt.ps1 [-xml] xml-input [-xsl] xsl-input [-output] transform-output"
exit;
}
trap [Exception]
{
Write-Host $_.Exception;
}
$tempFile = [System.IO.Path]::GetTempFileName();
(Get-Content $xml) -notmatch "[0-9a-f].*" | Out-File $tempFile
Import-Module ActiveDirectory
<# Get Distinguished Name #>
$objDomain = Get-ADDomain
$objDomainDN = (Get-ADDomain).DistinguishedName

<# Get current Domain SID #>
$CurrentDomainSID = (Get-ADDomain).DomainSID

<# Get Forest Domains #>
$objForestDomains = (Get-ADForest).Domains

<# Replace all SIDs in $tempFile that match any of the Forest Domains #>
foreach ($Domain in $objForestDomains) {
try {
$DomainResult = Get-ADDomain -server $Domain -ErrorAction SilentlyContinue | select DNSroot, DomainSID -ErrorAction SilentlyContinue
$xmlContent = (Get-Content $tempFile)
If ($xmlContent -match ($DomainResult | select -ExpandProperty DomainSID)) {
$xmlContent = $xmlContent -replace ($DomainResult | select -ExpandProperty DomainSID), ($DomainResult | select -ExpandProperty DNSroot)
$xmlContent | Out-File $tempFile
}
} catch {
Write-Host ("Exception while contacting Domain " + $Domain + ".")
Write-Host ($Error[0].Exception)
}
}
#>
<# Get Trusted Domains #>
$objTrustedDomains = Get-ADObject -SearchBase "CN=System,$objDomainDN" -SearchScope OneLevel -LDAPFilter "(&(objectClass=trustedDomain)(!trustAttributes=32))" -Property name, securityIdentifier
$TrustedDomainSIDs = $objTrustedDomains | select -ExpandProperty securityIdentifier
$TrustedDomName = Get-ADObject -SearchBase "CN=System,$objDomainDN" -SearchScope OneLevel -LDAPFilter "(&(objectClass=trustedDomain)(!trustAttributes=32))" -Property name, securityIdentifier | select -ExpandProperty Name
<# Replace all SIDs in $tempFile that match any of the Trusted Domains #>
foreach ($TrustedDomain in $objTrustedDomains) {
try {
$xmlContent = (Get-Content $tempFile)
If ($xmlContent -match ($TrustedDomain | select -ExpandProperty securityIdentifier)) {
$xmlContent = $xmlContent -replace ($TrustedDomain | select -ExpandProperty securityIdentifier), ($TrustedDomain | select -ExpandProperty Name)
$xmlContent | Out-File $tempFile
}
} catch {
Write-Host ("Exception while contacting Domain " + $Domain + ".")
Write-Host ($Error[0].Exception)
}
}
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform;
$xslt.Load($xsl);
$xslt.Transform($tempFile, $output);
remove-item -path $tempFile;

The call for an appropriate nam­ing convention for the provided script would go as follows:

.\ThinPrintLicenseReport.ps1 C:\temp\ThinPrintLicenseReport.xml c:\temp\ThinPrintLicenseReport.xsl c:\temp\ThinPrintLicenseReport.html

The display of the resultant ThinPrintLicenseReport.html file would look like in Illus. following.

The display of the resultant ThinPrintLicenseReport.html file


Summary

To show the license consumption from ThinPrint GmbH send us the report file in XML format – e. g. ThinPrintLicenseReport.xml.

For internal accounting, and the respective billing of your clients, you can generate reports that will show the license consumption per domain. For that purpose, you can use the sample script above.

If the domain cannot be resolved, it will be displayed in the domain name position on the SID.


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.