robertED
Flexera beginner

How to check for more than one feature using lmstat in lmtools?

Jump to solution

We want to use "lmutil.exe lmstat -f X" to report features in use to a Powershell script.

This works for one instance of X, but we want to check for 4 different features (X, Y, Z, Q).

Is there a syntax that allows us to do this, or do we need to run lmutil 4 times, ie once for each feature went want to check?

0 Kudos
1 Solution
ben-painter
Occasional contributor

Here is some powershell to accomplish that functionality:

foreach ($feature in $M3i, $M3a, $M2p, $M2l) {
&$Cmd lmstat -c 28000@our_server -f $feature
}

View solution in original post

0 Kudos
6 Replies
robertED
Flexera beginner

That is not an answer to what I was asking.

My notififications said that there was two replies to this topic, but I'm only seeing one (the unhelpful one).

0 Kudos
robertED
Flexera beginner

This is the script I'm working on:

$Cmd = "X:\path_to_lmtools\lmutil.exe"
$Arg = "lmstat -c 28000@our_server -f"
$Arg = $Arg.Split(" ")

# NX93300: = Mach 3 Industrial Design
# NX93110: = Mach 3 Additive
# NX92100: = Mach 2 Product Design
# NX12100N: = Mach 2 Legacy
$M3i = "NX93300"
$M3a = "NX93110"
$M2p = "NX92100"
$M2l = "NX12100N"

$Arg1 = $Arg += $M3i
& "$Cmd" $Arg1

$Arg2 = $Arg += $M3a
& "$Cmd" $Arg2

$Arg3 = $Arg += $M2p
& "$Cmd" $Arg3

$Arg4 = $Arg += $M2l
& "$Cmd" $Arg4



The problem is that I get a result only the first time I query lmtools in this script. The other three times I only get the default help text.

I can comment out each query, and it works separately, but apparently lmtools has some built in throttling of queries?

So, before I put in a delay and make everyone using this script annoyed, is there really no way to check for multiple features in one go?

0 Kudos
ben-painter
Occasional contributor

`lmstat -c 28000@server -a`

will give you all of the features at once.

0 Kudos
ben-painter
Occasional contributor

Here is some powershell to accomplish that functionality:

foreach ($feature in $M3i, $M3a, $M2p, $M2l) {
&$Cmd lmstat -c 28000@our_server -f $feature
}

View solution in original post

0 Kudos

Thanks, so in other words, each user running this script will query the server 4 times.

0 Kudos
ben-painter
Occasional contributor

That is correct. My other reply has the lmutil command for a single call. You can use powershell to parse that for the individual features.

0 Kudos