This tutorial explains how to send an email whenever your PC is logged off. The email will be sent whenever someone logs out from PC, or restarts PC, or shutdown PC. You can configure the email address to which email should be sent, as well as set subject and the body of the email.
Note: This tutorial uses Group Policy Editor feature of Windows. So, this will work in only those Windows versions which have Group Policy Editor feature available. For Windows 7, it will work with these versions: Professional, Enterprise, and Ultimate. For Windows 8, it will work with these versions: Professional and Enterprise.
We earlier covered how to get email whenever someone logs into the computer. There are a lot of uses for that. But why would someone want to get an email whenever someone logout or shutdown PC? There are multiple uses for that too. You might be an employer who wants to monitor at what time your employees logoff from PC. Or, you might be at school trying to see how long kids use a computer. Or, you might be at cyber café who wants to accurately know when your customers logged off from PC, so that you can bill them appropriately. In all of these scenarios (and many more such scenarios), it will be useful if you get an email whenever someone logs off from PC.
Let’s see how to do that.
How to Get An Email Whenever Someone Logs Off from PC:
As I mentioned earlier, we will use Group Policy Editor to accomplish this. Don’t worry; it is quite simple to use. Just keep following the steps mentioned here and you’ll be all set (do not mess with anything else while in Group Policy Editor).
Step 1: For sending email, we will use a free software called SendEmail. You can get it from here. Just download this software and keep the exe in any folder of your choice. It does not need installation. (If you want, you can use any other software also that can send email from command line; a good alternative is SendItQuiet).
Step 2: Start > Run > gpedit.msc > User Configuration > Windows Settings > Scripts (Logon/Logoff) > Logoff. (Basically, go to Start Menu. In the Run box, type gpedit.msc and hit enter. In the window that opens up, expand “Windows Settings” option under User Configuration. Click on “Scripts (Logon/Logoff)”. In the right side window, double click on Logoff).
Step 3: Then click on the Add option in the window that opens up. In the Script Name, browse the path of exe of SendEmail software that we downloaded in Step 1 (or any other email software, if you want).
Step 4: Below that is the box for “Script Parameters”. In this, you have to provide from and to email address, password of from email address, subject of the email, and body of email. Here is what you would typically type in it (assuming you will send email from a Gmail id or Google Apps id):
-f [email protected] -t [email protected] –u Subject_of_email_goes_here –m Body_of_email_goes_here -s smtp.gmail.com:587 -xu [email protected] -xp password_of_from_email -o tls=yes
This is another example, with values of some of the parameters filled in:
-f employee1@ilovefreesoftware.com –t [email protected] –u Alert!! Employee 1 has logged out from PC -m Attention Boss!! Employee 1 has logged out from PC. If that is too soon, run and stop him. -s smtp.gmail.com:587 –xu [email protected] -xp fake_password -o tls=yes
Then click on the Ok button to finalize the task.
Step 5: Nothing. You are already done. Yep, it was as simple as that. Now, whenever someone Logs off, Shutdown, or Restart PC, you will get an email. Pretty cool, isn’t it? And if you combined this with earlier tutorial to get email when someone logs in, you will be notified for both login as well as logoff.
The best part of using Group Policy Editor is that, it works in all the three scenarios: Shut down, Restart, as well as when you choose to Log off.
Conclusion:
The problem of getting an email on logoff (logout), restart, or shutdown seems pretty big. But Group Policy Editor makes things pretty simple. As you can see above, its just a 4 step process to set everything up. And once the setup is done, the PC will keep silently sending emails whenever someone logs off, without any action required from end of the user. I do wish that there was an easy way to do this via Task Scheduler as well, so that it could have worked with other versions of Windows too, but unfortunately that didn’t work for me (apparently, Microsoft did not create an event for logout in that). If you do know of a way to accomplish this, or run any script via Task Scheduler, let me know in comments below.