Recently as a part of support activity, I came across a unique task. This application had a windows service running on cluster of 8 different servers. To ensure that windows service is up and running, I had to check the timestamps of the log files this service was updating periodically. If timestamps on all the servers is within the reasonable limit, it meant that service is healthily running. Now the tiresome part of this task was to open shared folders located on eight different servers and checking the files. To add to my trouble, I also had to ensure that C&R (Crash & Recovery) servers are also in sync. So now I had 16 server shares to open and look for.
By nature, I am a lazy person and as you would have guessed, after doing the above exercise for about 10 days; my mind was trying to find a way to automate this task. Surely, I could have a written a small utility in .Net to check the files on these servers, but the efforts were not worth it. I wanted something quick and simple, something which can be achieved from command line. So I started looking for DOS commands which can do this, but I couldn’t find a command suitable for this. Google also didn’t help this time 🙁 but while surfing, I came across an article describing EXPLORER.EXE process and I googled whether it supported command-line options and BINGO!
That was the solution for my task. Explorer.exe is windows process which is responsible for providing GUI for doing file and folder management activities through Windows Explorer. But the utility does provides certain command line parameters as well. You can see list of all command-line switches at Microsoft Support site. For my case, it was series of commands for each of the server as below, grouped together in a batch file:
Isn’t that nice and easy?
Note: I tested this on Windows XP and Windows 2003 server OS only. You may want to visit Microsoft Support site to know which options are supported for which Windows OS.