1

I made simple batch file to produce txt file who are using the licences. I scheduled at every 5 minute using window scheduler. for Instance

run.bat

@echo off
REM See http://stackoverflow.com/q/1642677/1143274
FOR /f %%a IN ('WMIC OS GET LocalDateTime ^| FIND "."') DO SET DTS=%%a
SET DateTime=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2%_%DTS:~8,2%-%DTS:~10,2%-%DTS:~12,2%
echo %DateTime%

lmutil lmstat -a -c @hc-ukr-mu-ap-23 >%DateTime%.txt

2017-08-17_12-06-18.txt

lmutil - Copyright (c) 1989-2017 Flexera Software LLC. All Rights Reserved.
Flexible License Manager status on Thu 8/17/2017 12:06

[Detecting lmgrd processes...]
License server status: 27000@servername
    License file(s) on servername: C:\Program Files (x86)\ArcGIS\License10.5\bin\service.txt:

servername: license server UP v11.14.1

Vendor daemon status (on servername):

    ARCGIS: UP v11.14.1
Feature usage info:

Users of ACT:  (Total of 1 license issued;  Total of 0 licenses in use)

Users of ARC/INFO:  (Total of 4 licenses issued;  Total of 4 licenses in use)

  "ARC/INFO" v10.1, vendor: ARCGIS, expiry: permanent(no expiration date)
  floating license

    adi00516 C8QBXFY1 wy30_lAB;l|`dgw,' (v10.1) (servername/27000 2766), start Wed 8/16 11:58
    uvi00887 CBPMGBG2 w$<Dbk.0)n1tx{/JF (v10.1) (servername/27000 172), start Thu 8/17 9:40
    sri00571 CDT7VD02 w&B4alwyrVtX\_o*  (v10.1) (servername/27000 1341), start Thu 8/17 10:00
    sdi00608 C5VWHQ12 wv5Gf~+-&iy]adu)& (v10.1) (servername/27000 1543), start Thu 8/17 11:32

Users of ArcStorm:  (Total of 4 licenses issued;  Total of 0 licenses in use)

Users of ArcStormEnable:  (Total of 4 licenses issued;  Total of 0 licenses in use)

Users of Editor:  (Total of 5 licenses issued;  Total of 1 license in use)

  "Editor" v10.1, vendor: ARCGIS, expiry: permanent(no expiration date)
  floating license

    adi00516 C8QBXFY1 ww9-Tcqsl>N269I]X (v10.1) (servername/27000 807), start Thu 8/17 11:44

Users of GeoStats:  (Total of 1 license issued;  Total of 0 licenses in use)

Users of Grid:  (Total of 3 licenses issued;  Total of 1 license in use)

  "Grid" v10.1, vendor: ARCGIS, expiry: permanent(no expiration date)
  floating license

    adi00516 C8QBXFY1 wy30_lAB;l|`dgw,' (v10.1) (servername/27000 4201), start Wed 8/16 11:59

Users of MrSID:  (Total of 4 licenses issued;  Total of 0 licenses in use)

Users of Network:  (Total of 1 license issued;  Total of 0 licenses in use)

Users of Plotting:  (Total of 4 licenses issued;  Total of 0 licenses in use)

Users of Publisher:  (Total of 1 license issued;  Total of 1 license in use)

  "Publisher" v10.1, vendor: ARCGIS, expiry: permanent(no expiration date)
  floating license

    sri00571 CDT7VD02 w&B4alwyrVtX\_o*  (v10.1) (servername/27000 1289), start Thu 8/17 10:01

Users of TIFFLZW:  (Total of 4 licenses issued;  Total of 0 licenses in use)

Users of TIN:  (Total of 3 licenses issued;  Total of 2 licenses in use)

  "TIN" v10.1, vendor: ARCGIS, expiry: permanent(no expiration date)
  floating license

    uvi00887 CBPMGBG2 w$<Dbk.0)n1tx{/JF (v10.1) (servername/27000 1929), start Thu 8/17 9:40
    sdi00608 C5VWHQ12 wv5Gf~+-&iy]adu)& (v10.1) (servername/27000 3663), start Thu 8/17 11:32

Users of Viewer:  (Total of 3 licenses issued;  Total of 0 licenses in use)



----------------------------------------------------------------------------
License server status: 27009@servername
    License file(s) on servername: licenses\geoslope\configure.lic:

servername: license server UP v11.14.1

Vendor daemon status (on servername):

I want to check if anyone apart from this list is using the licence? it produces the files like said above every 5 minutes.

adi00516 uvi00887 sri00571 sdi00608

user1586957
  • 149
  • 2
  • 13

1 Answers1

2
@ECHO Off
SETLOCAL
SET "sourcedir=U:\sourcedir"
SET "filename1=%sourcedir%\q45728670.txt"

FOR /f "usebackqdelims=" %%a IN ("%filename1%") DO (
 FOR /f "tokens=1-3 delims=: " %%A IN ("%%a") DO IF "%%A%%B"=="Usersof" (
  SET "package=%%C"
 ) ELSE (
  SET "line=%%a"
  IF DEFINED package CALL :analyse
 )
)
GOTO :EOF

:analyse
:: remove any `"` from the line 
:: and interested only in the first 13 characters
SET "line=%line:"=%"
SET "line=%line:~0,13%"
:: turn analysis off if end-of-report-body
IF "%line:~0,4%" equ "----" set "package="&GOTO :EOF 
:: interested only in lines starting with 4 spaces
IF "%line:~0,4%" neq "    " GOTO :EOF 
:: first token in exemption-list
FOR /f %%A IN ("%line%") DO SET "luser=%%A"
FOR %%E IN (
 adi00516 uvi00887 sri00571 sdi00608
 ) DO IF %luser%==%%E GOTO :EOF 

ECHO User %luser% is using %package%

GOTO :eof

You would need to change the setting of sourcedir to suit your circumstances.

I used a file named q45728670.txt containing your data for my testing.

It would have been useful to include a report which contained usernames other than those that are exempt.

Read the file line-by-line, setting package if the first 2 tokens are Users and of. Include the colon in the delimiters to gratuitously remove the colon after the package name.

Analyse all other lines, once a package name has been detected (which ignores the header section of the report.)

First remove all " from the line, and consider only the first 13 characters. If the first 4 characters are ---- then this is the beginning of the footer section, so set package to empty to turn off analysis.

Any line starting 4 spaces is then a licence-in-use report line. Ignore any otheers.

Find the first token in the line, which is the userID

If the userID found is one of the exempt users, ignore the line.

Otherwise, report the package and user found.

(you just need to change the filename and include this routine after running lmutil - redirecting the output and acting on it is up to you)

Magoo
  • 77,302
  • 8
  • 62
  • 84
  • Perfect .thanks.! I scheduled this batch file every 5min and added in `ECHO User %luser% is using %package% > NonGISuserlist.txt`. so now I can list users who are using this apart from our team. – user1586957 Aug 21 '17 at 05:38