Find Out Who Is Logged Onto Sage ERP X3 Right Now - Part II

1 minute read time.

If you haven’t seen part one of topic, check that out here. Essentially, there are times in your X3 life where you’ll want to verify who is in the system for sure. Part one showed you how to do that from the console. You can also do that calling the PSADX program from outside of X3 directly through s command prompt batch script. You’ll have to first set up your environment variables using the env.bat file. Once you do that though it’s gravy from there on out.

Below, I’ve created some code for you that will show you how to create a log file with the active users in X3 right now. I know consultants who use this technique for troubleshooting situations where the batch server won’t start (trying to figure out if anyone is logged in already) or there is any anomaly with the logging into X3. Anyways, without further ado, here’s the batch file code:

@echo off

Echo Set Variables
set /p SolutionName=What is the solution name (usually x3v5 or x3v6)?
set REGKEY=HKLM\Software\Adonix\X3RUNTIME\%SolutionName%
set REGVAL=ADXDIR


REM query the value. pipe it through findstr in order to find the matching line that has the value. only grab token 3 and the remainder of the line. %%b is what we are interested in here.
set VALUE=
for /f "tokens=2,*" %%a in ('reg query %REGKEY% /v %REGVAL% ^| findstr %REGVAL%') do (
set myDir=%%b
)

Echo Run %myDir%\bin\env.bat
Call %myDir%\bin\env.bat

Echo Run psadx -afghimopx >%USERPROFILE%\myActiveUsers.log
call psadx -afghimopx >%USERPROFILE%\myActiveUsers.log

Echo launching log file: %USERPROFILE%\myActiveUsers.log
%USERPROFILE%\myActiveUsers.log

To leverage this code, create a new text file, copy the code above into the file and name the file getActiveX3Users.bat. This file needs to exist on the same server where the env.bat file exists, so most likely on your application server. If everything is set up correctly, when it is run, a new file will open up with a list of the users, which looks something like this:

Enjoy!

GetActiveUsers.zip