Apr 05 2012

Autodesk Inventor Network Licences in Use

Published by at 9:56 pm under Misc



There seems to be no tool to check who’s taken an Autodesk
Inventor network license. End users keep asking the IT staff
why they get no license to run the software and who they were
given to. I wrote this tool to avoid useless calls and give anybody
the ability to check who’s connected at this very moment, so they can deal with each other to release a license.
Inventor generates a log file in which each (dis)connection is recorded among other information. The script parses the file and displays online users.
 
Only 2 steps are needed to set this up:
– Set the path to the log file flex.log to a read only shared folder and give access to the end users.
– Create the following inventor.vbs script in the same folder.
 
The script was written in VB so it can be run from any Windows computer.
Set the “Users” variable to your own number of licenses.

 

Option Explicit

Dim objFSO, objFile, strTextFile
Dim line, allSessions(), offline, currentSessions, firstIndex
Dim i, l
CONST ForReading = 1
CONST Users = 4

'Log filename
strTextFile = "flex.log"

'Create a File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
if not (objFSO.FileExists(strTextFile)) then
   MsgBox strTextFile&" does not exist!", vbExclamation, "Error"
   wscript.quit
end if
Set objFile = objFSO.OpenTextFile(strTextFile, ForReading)

i = 0

' Search for connections in reverse order
Do Until objFile.AtEndOfStream
    Line = objFile.ReadLine
    If (not InStr(line, "(adskflex) OUT:") = 0) or (not InStr(line, "(adskflex) IN:") = 0) Then
        Redim Preserve allSessions(i)
        allSessions(i) = line
        i = i + 1
    End If
Loop

' Index in allSessions
On Error Resume Next
l = UBound(allSessions)
' Compte les licences
i = 0

if (l = "") then
   currentSessions = "Nobody connected"
end if

' Returns x last connections
' without duplicates
Do While (i < Users) and (l >= 0)
   line = split(allSessions(l))
   ' Cas heure < 10h
   if line(0) = "" then
      ' Check if user has not disconnected
      if StrComp(line(3), "In:", vbTextCompare) = 0 and InStr(currentSessions, line(5)) = 0 then
         offline = offline & line(5) & " "
      end if
      if InStr(currentSessions, line(5)) = 0 and InStr(offline, line(5)) = 0 then
         currentSessions = currentSessions & line(1) & " " & line(5) & VbCrLf
         i = i + 1
      end if
   else
      if StrComp(line(2), "In:", vbTextCompare) = 0 and InStr(currentSessions, line(4)) = 0 then
         offline = offline & line(4) & " "
      end if
      if InStr(currentSessions, line(4)) = 0 and InStr(offline, line(4)) = 0 then
         currentSessions = currentSessions & line(0) & " " & line(4) & VbCrLf
         i = i + 1
      end if
   end if
   l = l - 1
Loop

MsgBox currentSessions, vbInformation, "Licenses Inventor"
'wscript.echo currentSessions

objFile.Close

'Cleanup
Set objFSO = Nothing

 


3 responses so far

3 Responses to “Autodesk Inventor Network Licences in Use”

  1. Alexandre Jolyon 25 May 2012 at 6:26 pm

    Thanks Dave! This script is really useful. In my case, I had to change the log file name to \"debug.log\" (as per default).

    Also, I had a problem with network licenses not released after exiting Inventor. Although I\’m not sure if this issue occurred right after our 2012 upgrade but I found a way to fix it. See this KB (FYI) http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=5549171&linkID=9240617

  2. daveon 25 May 2012 at 6:35 pm

    You’re welcome, glad this was useful!

  3. daveon 11 Apr 2013 at 5:50 pm

    Changes:
    – Test if flex.log file exists
    – Bug fixed: Error was thrown when nobody connected

Trackback URI | Comments RSS

Leave a Reply