The time comes when a manager walks into your office and says “We’re tightening the belt this year. One way we’re looking to save money is to remove unused PCs from 1 area and move it into another area. Give me a list of all PCs that haven’t been used in X days.” You agree to do it without thinking as usual and think no big deal. After a few minutes of looking into it you then think “…ummm, what really does “unused” mean anyway?” Does “unused” mean users aren’t working on it and just use it as a Facebook machine? Does “unused” mean X application isn’t being executed on it or does it simply mean no keyboard or mouse activity at all?

After you grill the manager a little bit you find out that he wants all PCs that haven’t had any kind of keyboard or mouse activity for 1 week. Fine. Game on.

I came across this awesome StackOverflow question which did 90% of the work for me.

This is nearly exactly the same as the author example but I needed to modify it for a mass deployment. All I’m doing it executing the script on a workstation and getting the total idle time in minutes. I’m then adding this to a file called PCNAME-idletime.txt on a server. I’m using ConfigMgr so the deployment of the script was trivial. After all workstations completed and I had a whole bunch of TXT files in the server’s folder I then merged them all into 1 single CSV and voila!, the manager got what he wanted!

This one-liner lists all the text files and using calculated properties creates a name to idle time reference which I then export out into a CSV. What I end up with is something like this:


Ready to stop reading and start learning about PowerShell, DSC, Windows Server, Sharepoint, IIS and dozens of other categories? If so, check out the hundreds of free technical demo screencasts available on the new, IT career development platform TechSnips.

I hope this helps the next time you want to get unused PCs!

%d bloggers like this: