SQL Query to Display Jobs Run by User

SQL Query to Display Jobs Run by User
mrxinu's picture

XX_Rider and I worked out this query on the #altiris freenode channel and we thought it might be useful for the community at large:

A use case from XX_Rider:

"The SQL shows all the jobs in the database that were run by the user. Our need was to find out if our staff was using the deployment console. They claimed they were using it but we couldn't find any jobs pushed by them. Other uses would be if an employee leaves, maybe done something they shouldn't have before they left, or to find out what users are making use of the console efficiently, i.e., using jobs instead of doing things manually."

SELECT su.user_id,
       su.displayname,
       c.Computer_name,
       es.start_time,
       e.name
FROM   Computer c,
       event_schedule es,
       securityuser su,
       event e
WHERE  c.computer_id = es.computer_id
AND    su.user_id = es.user_id
AND    e.event_id = es.event_id
AND    su.displayname = 'some_username_here';

If you have any questions, don't hesitate to contact me.

4
Average: 4 (24 votes)

Query worked Great!

Thanks for the help in making the query. It has come in very handy keeping track of what jobs the other staff are using.

We use it to check up on our staff to make sure they were following procedures rather than doing things manually.

SQL query

I am going to use this next week since I also want to know if we are using the console for jobs.