Manage concurrent usage of software that doesn't use a smarter license server, such as Flex LM.
We have several pieces of software that don't use a license server. Because of this, we own n number of stand-alone licenses. When applicable, we can install this on as many computers as we want, such as in a VDI farm, and make it available as long as we can control concurrency. This is an attempt to control concurrency in these situations.
This module allows processes to be counted amongst any number of computers. We do this to ensure that the maximum allowed concurrent run is monitored per user per computer; three users on one computer counts as three usages but three processes by one user on one computer counts as one usage. For you DB engineers, the primary key is computer name and user name. When one more process is run over the maximum, the process is killed and the user is notified with an alert message.
I prefer to run this as a scheduled task that triggers at boot and re-runs every 15 minutes or so; that's discussed in the Deployment wiki article.
- Set the
$env:LicenseManager
Environment Variable; see the section below. - Install LicenseManager:
Install-Module LicenseManager
. - Import LicenseManager:
Import-Module LicenseManager
. - Start LicenseManager:
Invoke-LicenseManager
.
Using a [hashtable]
, make two keys:
[string] DirectoryPath
: See DirectoryPath parameter.[hashtable] Processes
: See Processes parameter.- Each
Name
is the process name with extension. - Each
Value
is an[int]
of the number of concurrent processes allowed to run.
- Each
When that's done, convert it to a compressed JSON and set it as the $env:LicenseManager
environment variable.
I suggest setting it via the same GPO that you use to run this at startup.
Here's a quick example:
$LicenseManager = @{
DirectoryPath = '\\license\LicenseManager'
Processes = @{
'notepad.exe' = 5
'Calculator.exe' = 10
}
}
$env:LicenseManager = $LicenseManager | ConvertTo-Json -Compress
There's really only one JSON string parameter: LicenseManager
.
You can see it in the Watch-LMEvent.ps1
script.
This is the main script.
The Parameter should look like this
{
"DirectoryPath": "\\\\license\\LicenseManager",
"Processes": {
"notepad.exe": 5,
"Calculator.exe": 10
}
}
- Type:
[string]
This parameter defines the central location where all computers/servers will report their usage of specific products. Each product in the Processes parameter creates a JSON for storing the Process IDs (PID) of processes that we care about. The JSON stored will not count multiple PIDs on the same user/computer as a separate instance. Here are some JSON examples:
- One computer with one user running one process.
- One computer with one user running ten processes.
- Ten computers with one user running one process.
Additionally, anytime a user is denied, an entry will be added to a CSV file that will also be in this location. This allows a report to be generated so we can determine if we need to buy more licenses.
This should likely be a UNC path.
If you're running as NT AUTHORITY\System
, be sure to grant domain computers read/write access to the UNC path.
- Type:
[hashtable]
- Each
Name
is the process name with extension. - Each
Value
is an[int]
of the number of concurrent processes allowed to run.
- Each