Limit Number of MDCC Instances Running
Limiting the number of instances of the MDCC application that can be started on a PC is possible through PowerShell Scripting. When users run multiple instances of Paper-less MDCC, they will consume one license key for each instance that is running. This essentially consumes more licenses than what is really required. This solution will help to save you from purchasing additional license keys to offset the users running the application multiple times on one device.
PowerShell to the rescue! Through the use of Windows Powershell and a batch file to start MDCC it is possible to limit the number of sessions running on any one PC. This limits the PC user to consuming only 1 concurrent license from the IBM License Repository.
A PowerShell Script Example is attached to this KB. Below is the code and explanation of it. Use Windows Powershell X86 to edit the file.
$processName = "PLMCQRMS" # Do not Change
$maxInstances = 1 # Set the maximum number of allowed instances
# Get all running processes with the given name
$runningProcesses = Get-Process | Where-Object { $_.Name -eq $processName }
# Check if the number of running instances exceeds the limit
if ($runningProcesses.Count -ge $maxInstances) {
Write-Host "Maximum instances of $processName are already running."
} else {
# Start the application if the limit is not reached
Start-Process"C:\Program Files (x86)\Paper-Less, LLC\MDCC 8.6.0\plmcqrms.exe" #Edit this path to point to the folder where you have ATM installed on the PC
}
The Batch File example is also attached -
@echo off
cd C:\Program Files (x86)\Paper-Less, LLC\MDCC 8.6.0
powershell.exe -ExecutionPolicy Bypass -File "C:\scripts\MDCCPowershellLimit.ps1"
Note: the "cd" path above must be the path to the folder where you installed MDCC on the PC.
To install and setup:
- On each PC, create a folder in the root of your C: drive called "Scripts" if it does not already exist
- Download the attached files to the C:\Scripts Folder created in the first step
- Use PowerShell X86 to edit the C:\Scripts\MDCCPowershellLimit.ps1
- Change the Start-Process "C:\Program Files (x86)\Paper-Less, LLC\MDCC 8.6.0\plmcqrms.exe" Line to the path were your plmcqrms.exe file is installed.
- Save the updated script
- Right click on the MDCC.Bat file and Send to Desktop -
- Find the new Icon on your Desktop -
- Right click on the Icon and select the Properties Option
- Click on Change Icon -
- Click OK -
- Click Browse -
- Browse to the folder where PLMCQRMS.EXE exists and select and click Open -
- Click OK -
- Then click Apply and OK -
- The Shortcut should now have the ATM Icon and it can be renamed to whatever you wish to call it. -
Functionality -
The first time the MDCC.Bat-Shorcut icon is clicked, MDCC will start up and the user can log in. If they try clicking the icon again, MDCC will not be started again.
A Command window does pop up and momentarily displays "Maximum instances of PLMCQRMS are already running." if there is more than 1 instance of MDCC running. However, it only displays for a very short amount of time and user will most likely not be able to see the message. If you wish to have this display the message to the user, add "TIMEOUT /T 5" statement to the last line of the MDCC.bat file and save it. The command window will display no matter what the message is until the user presses any key while the window is in focus.
IMPORTANT NOTE: This may not work on a terminal or application server.