How To Create An Automated PC Health Reporting System
Imagine a future world, where you’re having lunch with some friends and suddenly your phone makes an SMS ding. You recognize the sound as the alert tone you set for your computer issues. Checking the note, you read: “Computer Alert: Your home computer system has had 3 hacking attempts.”
The whole concept of having systems in place that could alert you to any and all issues with your computers isn’t really in the science fiction realm anymore. We’ve covered all kinds of useful remote techniques to monitor your computers, like setting up Growl notifications , monitoring computer health with SpeedFan, or simply connecting to your systems remotely using Remote Desktop.
Having your computer send individual notifications for specific computer problems could take a lot of work, especially because it involves diagnosing what could sometimes be pretty complex problems, and then sending the SMS through your router out into the Internet. Doable, yes. Easy, no. So, what if your computer could send you a full health report in the form of all of your various computer log files for you to troubleshoot your home computer issues or identify concerns, no matter where you are located in the world?
That’s what we’re going to do today – create an automated notification system where your computer will collect important log files and computer status information and then send all of that to you in the form of an archived file every day via email.
Tools Needed For Your Automated Notification System
To set up this system on your home computer, you’re going to need a few software tools that we’re then going to piece together and make them work in harmony. First, download and install Microsoft Security Essentials. This will perform all of the computer scans and logfile collections, and then package it all up nicely in an archive file.
Also, make sure that you’re signed up for an IFTTT account and try creating a few recipes , so you get used to it. You’ll also need a Dropbox account that’ll store your final reports (although not entirely necessary). You can check out or Dropbox guide for help setting it up. Finally, follow my Blat setup guide to install the Blat command-line email tool.
Setting Up MS Security Essentials
Once you have those four tools installed and ready to go, it’s time to schedule tasks that’ll collect your computer information and email it out.
Microsoft Security Essentials provides command line parameters you can use to package up log files. The command to do this is “mpcmdrun.exe -Getfiles -Scan”. You can find the executable in the c:\program files\microsoft security client\ folder. When you run that command from the prompt, this is what the script looks like.
It takes less than a minute to run, and then it packages all of the files into a CAB file and places it in the c:\ProgramData\Microsoft\Microsoft Antimalware\Support\ folder as “MySupportFiles.cab”.
As you can see, there’s a lot of information that gets accumulated and put in the CAB file – log files, system info, security threat info, product registration info, and more. The first thing you want to do is run this as a scheduled job every day. The easiest way to do this, so you don’t have to worry about the path (with spaces in it), is set up the path in your Path system variable – Control Panel -> System -> Advanced System Settings -> Environment Variables.
Click “Path” under System variables, and enter in “;c:\program files\microsoft security client\” at the end of the Variable value field. While you’re in there, also add the directory where you placed Blat.exe as well, so that the next step in this process works without any issues.
Now (after you reboot) you could just open any command prompt and type “mpcmdrun.exe”, and it would launch Microsoft Security Essentials.
Time to set up the scheduled task! Go to Control Panel -> Administrative Tools -> Computer Management -> Computer Management -> Task Scheduler”.
Create a new task and set it up to run every day at a specific time. To run the program, change the action to “Start a program”, enter “mpcmdrun.exe” in the Program/script field, and type “-GetFiles -Scan” in the “Add arguments” field.
In my case, I set it up to run at 8AM every day, first thing in the morning.
What you have working now is that MS Security Essentials will recreate a new, updated copy of the MySupportFiles.cab file in c:\ProgramData\Microsoft\Microsoft Antimalware\Support\.
Automatically Emailing System Status
The next step is to grab that file and send it to your email account. Whether you check your email from your hotel while you’re traveling or from your phone while you’re waiting at the doctor’s office, you will receive the notification from your computer with the attached data files.
With Blat set up on your machine (see the guide link at the start of this article), you can run the following command from the command prompt to send the file to any email address you like:
blat -body “Here’s today’s file” -to email@example.com -subject “PC Log Files” -attach “c:\programdata\microsoft\microsoft antimalware\support\MPSupprtFiles.cab”
You can run this as a new scheduled task (just like you did for MS Security Essentials), but just use “blat” as the program/script (because you already set up the PATH variable above). For the parameters, just use the rest of the command shown above, and use your own email address that you’d like to send the files to.
If you schedule this task to run an hour after Microsoft Security Essentials creates the CAB file, then you’ll automatically get the latest, freshest copy of the file with all of your computer’s latest data. Just open the file with any Unzip tool that works with CAB files, and you can review your computer’s status data, and identify any issues no matter where you are.
Storing Your Health Report in Dropbox
Now, if you really want to go above and beyond and store those log files in the cloud, all you need to do is set up a filter in your email client to look for all incoming emails with the subject you set in your Blat command. In my case it was “PC Log Files”.
Have this filter automatically set a label for that email as “PC Log Files.” We’ve offered help in the past with setting up filters , if you need it.
Next, you’ll need to create an IFTTT recipe to watch your email account for any email with that label (you’ll need to be using an email service IFTTT works with). If you’re just getting started with IFTTT, our useful IFTTT guide can really help.
The trigger will be the email label. The action will be extracting the attached file and putting it in your Dropbox account. This is pretty easy if you just choose Dropbox as the output option and select “Add file from URL”.
This will place the email attachment into your Dropbox folder “PC Reports”, as shown below.
This Is How This Will Work
So, at this point in your project, here’s what you’ve accomplished. Every day at a certain time, your computer will now automatically run MS Security Essentials and will collect and compact all of the latest log files and reports into one convenient zip file. About an hour later, your computer will automatically email that report file to your email address, and a copy will also be bounced to your Dropbox account for easy access and safekeeping.
Honestly, could automation make life any easier?
Would you use any kind of Windows automation like this? Are there any other interesting uses can can envision using this kind of automation for? Share your own ideas and projects in the comments section below!