Notification when someone login locally or remotely to the server

Hi,

We have windows server 2008R2. Is there any way that the server sends an email with login details (IP address, location,...etc) when someone login locally or remotely to the server? Or is there any application can do that if this is not doable in server features?

Thanks
Math TecAsked:
Who is Participating?
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.

Jose Gabriel Ortega CEE Solution Guide - CEO Faru Bonon ITCommented:
It's a way with a script something like this

https://gallery.technet.microsoft.com/scriptcenter/Get-LogonLogoff-Times-and-3acf7d62

Here's something similar...
And not, is not doable using server features

And it should be configured on the Active Directory GPO object in the Login/Login scripts feature


param($computer="127.0.0.1",$outputfile="C:\loginevents.csv",[switch]$writetoxml,$userName) 

$IP =(Test-Connection -ComputerName $computer -Count 1  | Select -ExpandProperty IPV4Address | select -ExpandProperty IPAddressToString)

if ($userName -eq $null) { 
    $userName=$env:username.toString() 
} 
 
$loginAllArray=@() 
$loginUserArray=@() 
 
$logoffAllArray=@() 
$xmlUserArray=@() 
$restartReg 
 
#Function to query the remote computer 
Function queryComputer($computer) { 
    $restartReg = $false 
 
    ping -n 1 $computer | out-null 
 
    if ($? -eq $false) { 
        echo "Computer not online. Quitting" 
        exit 
    } 
} 
 
queryComputer($computer)

Open in new window

0

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
CodeTwo SoftwareSoftware DeveloperCommented:
Sending an email whenever someone logs in will require some heave scripting. You can; however, use the Get-EventLog cmdlet to return  all login and logoff events for the server. Here is a guide on how to do this:
How to check event logs with PowerShell
0
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
Email Servers

From novice to tech pro — start learning today.