Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a way to have windows server email me a message anytime a user logs on to server?

share|improve this question
    
What version of windows? –  Nick Kavadias Nov 25 '09 at 2:54
    
win server 2008 –  zsharp Nov 25 '09 at 3:35

2 Answers 2

up vote 3 down vote accepted

On Windows server 2008 create a task using the task scheduler. Choose create task , and on the trigger tab choose to begin the task on login for any user. Under actions choose send an email. You might also want to set the seting under the settings tab to run a new instance in parallel if the task is running to catch multiple logons.

E-mail is sent using NTLM authentication for Windows SMTP servers, which means that the security credentials used for running the task must also have privileges on the SMTP server to send e-mail. If the SMTP server is a non-Windows based server, then the e-mail will be sent if the server allows anonymous access. If it's a Non-windows email relay you can instead kick off a script that send the email (which you can then specify the credentials used to relay in.

share|improve this answer
1  
how to specify user pass and user name for the remote smtp? –  zsharp Nov 25 '09 at 4:58

Sure, you could put a command into /etc/profile. Something like:

echo "$USER logged in" | mail -s "Login Notification" user@example.com

I just tested this on my Debian server and it worked just fine.

share|improve this answer
    
Hah - I missed the "windows" part. Nevermind. I'll leave my "answer" up, though, in case it might be helpful for someone. –  EEAA Nov 25 '09 at 2:57
    
thanks for the tease –  zsharp Nov 25 '09 at 3:36
    
@zsharp install cygwin if you wish to use this solution! –  Nick Kavadias Nov 26 '09 at 14:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.