Like many of you the work day just seems to fly by. At the end of the day I start wondering what I really got accomplished and what I actually did all day. Well if you are willing to face the truth I have a way to help. Last year I wrote about a PowerShell module I called MyMonitor. As part of my ongoing effort to make some of my larger projects more accessible, I have revised it and published to GitHub.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
The MyMonitor module works under the premise of keeping track of what window is currently active and how long it has been running. I can also extract other information using Get-Process that indicates the window title, the associated product, when the process started and when it ended. I include the processID as well, although that probably doesn't have any practical value.
The data collection process starts with Get-WindowTime. You can specify a time duration in minutes such as 60 minutes. Or perhaps you want to collect your usage data until 4:00PM. You can do that as well. One way that I use the command is with the ProcessName parameter. The concept is that you can start an application that you rarely use. When Get-WindowTime detects the process, it terminates collection. I typically use Windows Calculator as a "flag" process. Finally, you can run all of this as a background job so that you can get your PowerShell prompt back. Just don't close your session before you stop the job and collect the data.
The new version also includes categories. I created an XML file in the module with categories for different applications. You can have an application with more than one category. This adds another way to see where you are spending your time. More on that in a moment. When you collect your usage statistics, you'll get an object like this for each application.
data sample
The module includes a few cmdlets for reporting and analyzing the data.
Getting a summary report
Or you can use Measure-WindowTotal to slice and dice the data.
Measuring window time by application
Measuring window time by category
You can even get a bit more granular be filtering on text in window titles.
Measuring time by window title (Image Credit: Jeff Hicks)
All of the commands in the module have complete help and examples. There is also an About topic.
About_MyMonitor
The module is still a work in project. One of the items on the wish list is a better way to archive usage. This would allow you get a better idea of where your time goes on a weekly or monthly basis.
But for now, you can get the module source files from the repository on GitHub. I strongly recommend you read the About topic and help before you start using the module. Comments are welcome here but please use GitHub to report any problems or feature requests.
Another interesting post. Looking forward to reading the code. Thanks Jeffery!
Greetings Jeff!!!
I am interested in using this little nice tool.
I have loaded the powershell module and tried to collect
the usage statistics but it gives me the below error
PS C:\Users\pradeepl\Downloads\MyMonitor-master\MyMonitor-master> $data | Measure-WindowTotal
Measure-WindowTotal : The term ‘Measure-WindowTotal’ is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:9
+ $data | Measure-WindowTotal
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Measure-WindowTotal:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\pradeepl\Downloads\MyMonitor-master\MyMonitor-master>
Can you please tell me what am I missing here ?
Regards
Pradeep
The module files must go in a directory with the same names as the .psd1 and .psm1 files. Normally this would be under C:\users\\documents\WindowsPowerShell\Modules. Then you can run the command or import the module. Otherwise you can try renaming the .psd1 and .psm1 files to match the directory name. Then you’ll will have to manually import the module with the full path: import-module c:\users\pradeep\downloads\mymonitor-master.
You might also want to read the help file about_modules.
I’ve successfully installed the module and was able to run Get-WindowTime, however the get-help doesn’t indicate any usage methods…
I assume (based on screenshots alone) that the idea is $data = Get-WindowTime -minutes 5 (or something similar), however if one would like to run this in the background (as you recommend) for say, 8:30 – 17:00, how should I go about that?
I’m very interested in something like this and determining where/what I’m spending my time on should help me become more accountable 🙂
Thanks in advance.
Ah, it shows usage in the Measure-WindowTotal help file… I should have checked further…
Did you look at full help with examples? I use the AsJob parameter and there should be an example.