A colleague of mine uses this handy tool (and now I do too!). It’s called a “for loop“. From a Windows command line you can run an executable with options against a list of PC’s (or any list for that matter). The command will iterate through each item in your list.
Here’s the code and procedure:
PSTools lets you run remote commands on Windows PC’s download it and extract the files: Download
Make a list of PC’s in your domain, M$’s got a nice method for enumerating computers in a Windows domain: Link
To make it easy, put your text file with the list of domain computers in the same directory of your PSTools (I called mine “computers.txt”). Open a command prompt and migrate to the PSTools directory. If you type in “for /?” you get a HUGE list of methods for the “for” command line methodology.
You’ll see a line like this in the list which is what we’re using, I list the process running called “OUTLOOK”, this means those in the list are actively running OUTLOOK:
FOR /F [“options”] %variable IN (file-set) DO command [command-parameters]
Run this: for /f %i in (computers.txt) do pslist -e OUTLOOK %i
You’ll get something back that looks like this:
Process information for COMPUTER:
Name Pid Pri Thd Hnd Priv CPU Time Elapsed Time
OUTLOOK 2520 8 40 2540 218408 0:01:23.750 8:10:55.620
Outlook takes a shade over 1 minute of my CPU time in the 9 hours my PC’s been up and running. If you’ve got a rougue process taking over a machine somewhere on your network pslist.exe is a great way to inspect that machine and evaluate what’s running or how many resources something is utilizing.
You can browse the PSTools apps to see what hidden treasure you can find or download other exe’s that run on Windows! Cygwin has a TON of exe’s that run on Windows, they can help you do all kinds of automated tasks on your machine or remote machines. I know I haven’t even cracked the surface!
How about to copy a screenshot to a file using pstools, psexec or whatever to be able to see it from another machine like a spy?
Hi – I’ve used an application from http://masterbootrecord.de called “AdvancedRemoteInfo”. It has a screen shot plug-in that doesn’t come with the default app (or maybe it does now?). It’ll allow you to run it and do exactly what you’re looking for, you can even schedule the screen shotting for different time durations. Be forewarned though that depending on what type of organization your work for you’ll want to run the use of such a program past your management. I once unwittingly got into hot water over that feature even though I didn’t use it maliciously, I only used it for support reasons since our approved remote software was not working. I’d ask the user to do something, screen shot, do something else, screen shot, etc. It also has remote information like cpu, ram, bios versions, etc that you might be looking for BUT I have had problems running it in “batch mode”, it usually hangs (or used to). I haven’t used the app in a long time because it was only useful for a single use scenario. Good luck and let us know how it works out for you!