We have a requirement to send an e-mail to a specific address when any user logs on. This is on a Windows 2003 server, does anybody know or can point me in the right direction on how to do this? I assume there is some PS script that can run on the logon event but I've never done something like this before.
One way of doing this is to parse through logon events in Event Viewer. You would have to kick a PowerShell script off when the user logged in that would search for events in the Security log and look for successful logons from users. You'd then have to have your PS script extract the user from the logon event and pass that through to the email you're wanting to send. To accomplish this you could use Task Scheduler, please see my screenshot below:
You'll have to choose between the two red highlighted options.
If you want actual code I can talk to my VB/PowerShell guy. Let me know, thanks.
You could also bypass the PowerShell script altogether if you wanted to just use Task Scheduler. You could follow my steps above to create a Basic Task that starts when an event is triggered and then on the next screen it asks you which event you want to trigger on, and the screen after that gives you options of what you want Task Scheduler to do upon finding this event and one option is to Send An Email. Please see the following screenshots for more clarification.