Hi,
Human resources asked us for a way to confirm users are working throughout the day as reported by their key cards. I’m thinking that the best way to accomplish this is to use the checks from the Power Management module. To my understanding, the innate Power Management statistics only give me the duration of a given user’s last idle/busy cycle or generic information about their idle/busy times, whereas I need to provide statistics for the time my users spent at work, not measure the time they took ‘off’ for their bathroom breaks or food or corporate meetings.
Specifically, I intend to run a task on a daily basis in the evening a few hours past the end of the work day that checks for the duration of the idle state. Through simple math I would be able to conclude when the user stopped using his or her computer for the day.
I’m less certain on the starting time for the day. Using the idle checks for that feels unnecessarily cumbersome, so is there an easier method? Perhaps checking in the evening for the first login time that day? At present I’m merely assuming people don’t come in late while I work out the bugs with what I have so far.
Finally, I want to find a way to record this information for at least a month back. That way, when HR want to check a given department I could provide statistics for them. I was thinking of writing the ‘day start’ and ‘day end’ values in a text file located under the BigFix directory on the local disk.
This is what I have so far:
parameter "mainPowerLogFolder" = "{parent folder of client folder of current site}/__Global/UsageData"
parameter "mainPowerLogFile" = "power.csv"
if {not exists file (parameter "mainPowerLogFolder" & "\" & parameter "mainPowerLogFile")}
createfile until _end_
User,Timestamp,Start of Idle Time,State
_end_
move __createfile "{parameter "mainPowerLogFolder"}\{parameter "mainPowerLogFile"}"
endif
if exists {name of current user}
waithidden cmd.exe /C echo {name of current user},{concatenation "" of substrings separated by "," of (now as string)},{concatenation "" of substrings separated by "," of (start of range of (current system interval of power history) as string)},{state of current system interval of power history} >> "{parameter "mainPowerLogFolder"}\{parameter "mainPowerLogFile"}"
endif
I originally considered using “if (state of current system interval of power history = idle)” as a condition, though since I’m logging the idle state status it felt extraneous.
I have two issues with this task. The first is that for a reason I can’t understand I get a large amount of failures when trying to run it on the company computers, even on computers that previously managed to run it properly. I’m talking about the area of 20-40% of total computers whenever I try to run it.
The second is that I only manage to write the first set of values into the file, rather than append to it properly. I tried running the task as policy, but I ran into issues with that. It seems that I can set it to try again and again (say in case the computer was turned off) until it succeeds, but once it succeeds it stops, whereas I need to try and get data on a daily basis (conditions permitting).
In summary, I’d appreciate a way to fix this or, at least, to understand what I’m doing wrong. Also, is there a more elegant way of doing this?
Sincerely,
Ely