Find Primary User of Computer

Hi, i am looking for a way to find the primary user of all workstations based on who logged on the most (Out of the last few logons).

I found a few VERY old articles that got me started but they all had some sort of problem. (one would not let me import the bes file so i had to remove some extra xml coding at the bottom of the bes file to get it to import. one had some bad code in the property that i was able to snip out). Basically what i have now (that is working nearly perfectly) is a property (see relevance below) called “Primary User” and an action that creates a few client settings that contain the logon history (and it does it everytime a user logs in when it becomes relevant again). i think the property reads that and decides the primary user based on number of logons. the problem is that i am having is that when a user logs off it adds “None” to the logon history. so often “None” is the larger number and gets reported as the primary user.

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014749767

If someone could help me update the following property code below to not report “None” then i would be good to go. but i was also wondering if there was a “Newer” way to do this. or maybe even something that’s built into TEM now.

I am so close to getting this working if i can just figure out how to get it to not report “None”.

Here is the property that i am using now to report the primary user. (this needs to be fixed to not show “None”)

if ((preceding text of first “||” of (it & “||”) of concatenation “||” of (if (exists setting “LogonHistory” of client) then (concatenation “||” of unique values whose (multiplicity of it = (maximum of multiplicities of unique values of preceding texts of firsts “;;” of substrings separated by “::” of (value of setting “LogonHistory” of client as string))) of preceding texts of firsts “;;” of substrings separated by “::” of (value of setting “LogonHistory” of client as string)) else (“No Data - Client Setting Does Not Exist”))) = “none”) then (preceding text of first “||” of (it & “||”) of concatenation “||” of (if (exists setting “LogonHistory” of client) then (concatenation “||” of unique values whose (multiplicity of it = (maximum of multiplicities of unique values of preceding texts of firsts “;;” of substrings separated by “::” of (value of setting “LogonHistory” of client as string))) of preceding texts of firsts “;;” of substrings separated by “::” of (value of setting “LogonHistory” of client as string)) else (“No Data - Client Setting Does Not Exist”))) else (preceding text of first “||” of (it & “||”) of concatenation “||” of (if (exists setting “LogonHistory” of client) then (concatenation “||” of unique values whose (multiplicity of it = (maximum of multiplicities of unique values of preceding texts of firsts “;;” of substrings separated by “::” of (value of setting “LogonHistory” of client as string))) of preceding texts of firsts “;;” of substrings separated by “::” of (value of setting “LogonHistory” of client as string)) else (“No Data - Client Setting Does Not Exist”)))

1 Like

This is definitely something that would be useful, and something others have attempted. I haven’t taken too much time to dig into it, but there should also be some of this data that can be mined from BES Client logs (I recommend setting them to 30 days or more) as well as Windows Event Logs, and possibly WMI as well.

Here is the link in the new forum to that older post: Recording "Primary User" of a computer

Also, look at this:

(name of it, logon count of it) of users

This uses single recursion to get the user that logs on the most:

names of users whose( logon count of it = maximum of logon counts of users )

Also, consider tagging machines with ActionScript:

action parameter query "PrimaryUser"

setting "PrimaryUser"="{ parameter "PrimaryUser" }" on "{parameter "action issue date" of action}" for client

These are related:

https://bigfix.me/relevance/details/2996987
https://bigfix.me/fixlet/details/2533

Also, look at this: https://bigfix.me/relevance/details/2998769

I just made a simplified property that grabs last logged on user: https://bigfix.me/relevance/details/3002514

(it is based upon the relevance linked above)

Here is a work in progress analysis that I plan to expand and add to: https://bigfix.me/analysis/details/2994820