Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

automated email alert each time any user attempts to login to servers using RDP

$
0
0

Hi,

I am totally new to Powershell and scripting and would very much appreciate some help.

I have a user that needs to be notified each time someone RDP's to two specific application servers.

Does anyone here have an idea how we can do that using a powershell script.

think I have the email part working but need the the part that can monitor the login to the server with RDP and create an output file then email the file to the user.

 

$smtpserver = “exchange server name”

$msg = new-object Net.Mail.MailMessage

$att = new-object Net.Mail.Attachment($filename)

$smtp = new-object Net.Mail.SmtpClient($smtpServer )

$smtp.EnableSsl = $True

$smtp.Credentials = New-Object System.Net.NetworkCredential(“domain\username”, “password”)

$msg.From = “email address”

$msg.To.Add(”email address”)

$msg.Subject = “RDP Login Report $timestamp”

$msg.Body = “RDP Report ATTACHED”

$msg.Attachments.Add($att)

$smtp.Send($msg)


Viewing all articles
Browse latest Browse all 6937

Trending Articles