Notification of logging into servers

I'm looking to find a way to implement a way to notify via email that somebody is logging into any of our servers we have.... Does anyone have an idea and advice as to how to implement this?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITEnd-user supportCommented:
One way...
1. Download Blat (or other command-line mailer)
2. Add this to your user logon script:
blat -server yourserver -to -f -subject "%username% logged in from %computername% at %time%" -body "%USERNAME% logged in from %computername% at %time%"

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RVFB ITAuthor Commented:
we use gmail... wondering if you could elaborate those parameters based on knowing that fact? i've looked at syntax for blat and tried a couple times with no luck
NVITEnd-user supportCommented:
>> we use gmail
To use w/ gmail, you have to setup a connection via an SSL tunnel. See:

>> ...elaborate those parameters
See for parameter descriptions.

Testing in a CMD prompt before adding or calling it from your logon script helps, too.

I've tested this, which works. Make a .bat file of it:
- For testing/issues, un-REM the debug and log lines below.


set svr=-server
set to=-to
set from=-f
set subject=-s "%username% logged in from %computername% on %date% %time%"
set body=-body "%USERNAME% logged in from %computername% on %date% %time%"
REM set debug=-debug
REM set log=-log \\server\share\blat-debug.txt

blat %from% %svr% %to% %subject% %body% %debug% %log%

Open in new window

Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

RVFB ITAuthor Commented:
I added Stunnel and when i try to run the following in a batch file, a DOS window just continuously loops and keeps executing this forever and ever... I starred my password out for security of my email account... I feel like i'm really close to having this, but can't get past this batch script file for some reason... why is it doing an infinite loop? and i never get an email..

set PW=*****
set FROMNAME=Server Logon Notification
set SUBJECT="%username% logged in from %computername% at %time%"
set BODY="%username% logged in from %computername% at %time%"
blat -server %SERVER% -f %FROMNAME% -u %USER% -pw %PW% -to %TO% -cc %CC% -subject %SUBJECT% -body %BODY%
RVFB ITAuthor Commented:

I tried your batch script too and it just does an infinite loop and never sends me an email.... dont know what i'm missing here
RVFB ITAuthor Commented:
I ended up going with the SendEmail command line mailer... It didn't involved Stunnel and was simpler and got me the results I wanted in the end. Thanks!
NVITEnd-user supportCommented:
Thanks for the update, Keith. I appreciate it. I'm glad you found a simpler solution SendEmail. I'll consider SendEmail, also.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Server OS

From novice to tech pro — start learning today.