web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

kill online user in dynamics ax 2009

(0) ShareShare
ReportReport
Posted on by

Hi All,

Is there a way to remove instantly all the active users on Dynamics AX 2009? I mean, all open/online AX application will be close automatically once I run a specific script?

Currently I have a job that will kill all the online users using SQL job. During my testing on DEV environment I open five (5) AX application on different computers then I run the SQL job to kill connection. When I check the online user all of them are remove on the Administration-->Online Users-->Client Session> but whether they already remove on the online users, the AX application of the five users or the front end AX is still working or did not close automatically.

Here is one of the step in my script to kill online users;

---

UPDATE [SysClientSessions]
SET [Status] = 0

----

Please help.

Thanks...

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: kill online user in dynamics ax 2009

    "Killing" sessions is a horrible idea, especially from SQL Server - you are breaking business logic that will quickly cause your AX database to be corrupted.

    If you want to block users, the correct way is to drain the AX AOS from the online users form once you have started your client after restarting a single AX AOS account.

    Since for newer versions of AX draining can cause issues on some maintenance steps, I have changed the code where I set a custom Maintenance checkbox within the AX Server configuration form in the System administration module, and when the flag is set, I end non-sysadmin sessions in \Classes\Application\startupPost() method by calling something like this. Code should be compatible with AX 2009 with minor changes. You could use a timeout in case you want to show up a dialog box or something for the user informing about the maintenance mode.

    public static void WIK_validateMaintenanceMode()
    {
        xSession        axSession           = new xSession();
        ServerId        currentAOSInstance  = Session::getAOSInstance() + '@' + axSession.AOSName();
    
        if (isRunningMode()
            && !SysModelStore::isInstallMode()
            && (!isDeveloper()
                || !isSystemAdministrator())
            && (select firstOnly WIK_Maintenance from SysServerConfig
                where SysServerConfig.ServerId == currentAOSInstance).WIK_Maintenance == NoYes::Yes)
        {
            infolog.addTimeOut(appl, methodStr(Application, WIK_shutdown), 100, false);
        }
    }
    public void WIK_shutdown()
    {
        infolog.shutDown(true);
    }
  • Martin Dráb Profile Picture
    235,961 Most Valuable Professional on at
    RE: kill online user in dynamics ax 2009

    If you want to be sure that nobody is using AX while you're maintaining the database, simply stop AOS services.

    Nevertheless rebuilding indexes can normally be done with users using the system.

  • Suggested answer
    Deepak Agarwal Profile Picture
    8,585 on at
    RE: kill online user in dynamics ax 2009

    Hi Jean,

    There are few other option, You may want to check out,

    Limiting user sessions(Set Timeout For User Session) (theaxapta.blogspot.in/.../limiting-user-sessionsset-timeout-for.html)

    Restrict Multiple Time login of a same user (theaxapta.blogspot.in/.../how-to-restrict-multiple-time-login-of.html)

  • Community Member Profile Picture
    on at
    RE: kill online user in dynamics ax 2009

    Hi Martin,

    Thanks for your advice, i appreciate that much. But I was using the script for our maintenance plan and i want to make sure that no one is using the dynamics ax once I run my reindex script.

  • Martin Dráb Profile Picture
    235,961 Most Valuable Professional on at
    RE: kill online user in dynamics ax 2009

    Doesn't AX 2009 have a button on the Online users form to terminate user sessions? If so, you can use the same logic.

    Never meddle with data directly in database; you're forgetting that there running processes that already has the data loaded and you could introduce various data corruption. Work through the application.

    You already complained on another forum that your script causes AOS to crash, so it should be obvious to you that it's not a good approach.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans