Created
June 17, 2018 22:24
-
-
Save cmaggiulli/12c8e6ed72d2f884e9aa3f63aa2188f4 to your computer and use it in GitHub Desktop.
A PowerShell script I use to retrieve the IP address of a user (see: family member) I'm attempting to assist with a remote viewing tool.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ip=get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.Ipaddress.length -gt 1} | |
$EmailTo = "postmaster@yourdomain.com" | |
$EmailFrom = "DoNotReply@example.comm" | |
$Subject = "$($ip.ipaddress[0])" | |
$Body = "$($ip.ipaddress[0])" | |
$SMTPServer = "smtp.example.com" | |
$SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body) | |
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) | |
$SMTPClient.EnableSsl = $true | |
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential($EmailFrom, "P@33w0rD!"); | |
$SMTPClient.Send($SMTPMessage) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment