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 GP (Archived)

Script to detect if users have properly logged out of GP??

(0) ShareShare
ReportReport
Posted on by

We have users who don't properly exit or log off GP 2013 before they leave for the day.
Is there a script that can detect such users and send a report??

I would really prefer a PowerShell script but a SQL script would work too.

Thank you, Tom

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    KirkLivermont Profile Picture
    5,985 on at
    RE: Script to detect if users have properly logged out of GP??

    Tom,

    Do you need to run this at a scheduled time? select * from Dynamics..Activity will show you any users that are currently active or that did not log of cleanly.

    Regards,

    Kirk

  • Community Member Profile Picture
    on at
    RE: Script to detect if users have properly logged out of GP??

    End of day, say 9 pm or later, I believe these people would have to be managed manually b/c they might have left processes running?? -- and that's why I may only be able to have a report per se??

    Is it possible to put that select statement into a script then have the results emailed??

    Something like this (air code, how to improve??)

    USE DYNAMICS
    select * from dbo.activity
    if the above select is run in the evening it would show all users who are still logged in OR not correctly logged out...
    save results somehow
    email the results to an email address
    do this as an agent job or SProc during the evening

    I am not a SQL expert or programmer...

    What would I look for to learn how to do this??

    I don't know a lot about GP, I don't work in it, I do more IT/server work per se so I know something like this ought to be possible...

    Thank you, Tom

  • Suggested answer
    Mahmoud Saadi Profile Picture
    32,738 on at
    RE: Script to detect if users have properly logged out of GP??

    I have developed a script for User Activity Report - Idle and Login Details SQL Script , it retrieves not only user records from Dynamics GP but associated SQL session details and idle time as well.

    Your feedback is highly appreciated,

  • Community Member Profile Picture
    on at
    RE: Script to detect if users have properly logged out of GP??

    Thank you for offering this script.

    Have you revised the script to work properly with GP 2013 SP2??

    Please see the first comment, dated 1/2/15.

    How would one email the data??

    Thank you, Tom

  • Mahmoud Saadi Profile Picture
    32,738 on at
    RE: Script to detect if users have properly logged out of GP??

    Hello Tom

    That comment is just right, a new functionality was introduced with R2 which was thoroughly explained by my friend Tim Wappat on a previous post Check for user messages - GP Process Monitor

    I am quoting Tim from a previous thread:

    "Be aware that every min GP will be performing a query on an inbuilt timer, so the session that is on will never get truly idle.

    Due to this event occurring I would expect a maximum idle time of 1 min from any examination of SQL session, on the newer versions of GP (2013 onward).

    "

    In this essence, I am afraid that such piece of information could hardly be provided by my script as thoroughly explained by Tim.

    For the present time, I still have no other work around solution or an alternative way to detect the idle time, but there must be a way out of this. I will make sure to post any updates accordingly.

  • Community Member Profile Picture
    on at
    RE: Script to detect if users have properly logged out of GP??

    How could/should the script be edited to NOT include the idle time query and column??

    I would do it but I don't know GP/SQL to know when/if I would be making a big mistake(s).

    We could do without that part to have the other parts work properly in GP 2013 SP2.

    Perhaps post a revised script at your website without the idle time query and column??

    Thank you, Tom

  • Suggested answer
    Tom Cruse Profile Picture
    1,477 on at
    RE: Script to detect if users have properly logged out of GP??

    Here's another food for thought, if you use a terminal server you can check to see which users are not logged into the server and which ones are in the dynamics activity log. If they show up in dynamics.dbo.activity but not in the server user log in task manager then that's a sure fire way to tell.

    You could write a powershell script to export the system user activity log to a file and then import that into a temp table in GP where you can then compare that to the activity table.  Probably want to write a stored procedure that executes the powershell export and import so you can get a real time comparison.

    This might be overkill but it should do the trick. :)

  • Community Member Profile Picture
    on at
    RE: Script to detect if users have properly logged out of GP??

    Hi Tom,

    Thank you for this idea, but I want to query dynamics.activity *after( all the terminal services/RDS users are logged out for the day and only see which GP users are still 'remaining.' I basically know all the users are logging off the RDSH servers but they are not necessarily properly exiting/logging off GP.

    Thank you, Tom

  • Suggested answer
    Tom Cruse Profile Picture
    1,477 on at
    RE: Script to detect if users have properly logged out of GP??

    Well if you already which user has logged off through RDS then the activity table is all you'll need to know, while you're at it you might as well clear out the sy00800, and tempdb..dex_session and the tempdb..dex_lock to make sure there are no locked tables and objects from orphaned users.

  • Community Member Profile Picture
    on at
    RE: Script to detect if users have properly logged out of GP??

    Thank you, I will try to learn more about this etc.

    Thank you, Tom

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans