Your technology certification is waiting. Enroll in Cloud Class ®
Get-QADGroupMember -Identity "Domain admins" | FT Name > C:\members.txt
###change the mail message values in this section
$FromAddress = "Administrator@**.**"
$ToAddress = "D.Ilyin@**.**"
$MessageSubject = "Group Membership Report"
$MessageBody = "Attached is the current list of mailbox sizes."
$SendingServer = "srvex1.**.**"
###Create the mail message and add the text file as an attachment
$SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress, $MessageSubject, $MessageBody
$Attachment = New-Object Net.Mail.Attachment("c:\members.txt")
Start-Sleep -s 5
###Send the message
$SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.