Announcement

Collapse
No announcement yet.

alert by e-mail when a user logs on to an RD

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • alert by e-mail when a user logs on to an RD

    Hi all,
    I'm trying to run a batch script that sends an email alert when user logs on trough RDP whether a new session or a disconnected session
    where can i put this script to run every time when a user logs on whether to a new session or a disconnected session
    here's what i'm trying to do using blat http://www.blat.net
    Code:
     
    for /F "tokens=3" %i in ('netstat -ano ^| find /i "est" ^| find /i ":3389"') do @set ip=%%i
    blat  -to [email protected] -subject "Log in by %USERNAME% on %Date% at %TIME% to machine %COMPUTERNAME% FROM %ip% " -body "Log in by %USERNAME% on %Date% at %TIME% to machine %COMPUTERNAME% FROM %ip% "  -u username -pw password
    i tried User configuration > windows settings > Logon scripts but it only fires once at user logon
    then when a user logs to a disconnected it doesn't fire again .
    thanks in advance
    Last edited by [email protected]; 8th March 2009, 18:18.

  • #2
    Re: alert by e-mail when a user logs on to an RD

    1. Please use a real logging system and not scripts...

    2. You can force log off after x minutes of disconnected session.
    Best Regards,

    Yuval Sinay

    LinkedIn: https://www.linkedin.com/in/yuval14, Blog: http://blogs.microsoft.co.il/blogs/yuval14

    Comment


    • #3
      Re: alert by e-mail when a user logs on to an RD

      Thanks for your helpful tips
      but i do check security logs regularly and i don't want to enforce session expiration or force logoff after timeout because sometimes i want to keep sessions as is
      let me rephrase my query
      I want to run a
      script whenever any user logs onto the Terminal Server whether to a new session or a previous disconnected session . The script will send
      an email for tracking logons.
      The "start a program upon connection" gp setting won't work since I don't
      want to alter the session, I just want the script to run send the email
      whenever a user logs on to the Terminal Server.
      The Terminal Service Configuration / Connection > Connections > Environment> Initial Program
      also won't work for me
      any idea

      Comment


      • #4
        Re: alert by e-mail when a user logs on to an RD

        I suppose you could use Eventtrigger.exe and Audit account logon events as per this:
        http://forums.petri.com/showpost.php...13&postcount=2

        However, you'll need to change the VB script somehow to harvest the information you need and send as e-mail content.

        Please note though that you'll be getting loads of these e-mails when you create the eventtrigger.
        Caesar's cipher - 3

        ZKHQ BRX HYHQWXDOOB GHFLSKHU WKLV BRX ZLOO UHDOLVH LW ZDV D ZDVWH RI WLPH!

        SFX JNRS FC U6 MNGR

        Comment


        • #5
          Re: alert by e-mail when a user logs on to an RD

          Thanks
          That's exactly what i want

          Comment


          • #6
            Re: alert by e-mail when a user logs on to an RD

            Originally posted by yuval14 View Post
            1. Please use a real logging system and not scripts...

            2. You can force log off after x minutes of disconnected session.

            Any real time logging system in mind, Yuval??

            Comment

            Working...
            X