Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Get the number of extensions sorted by count table, outout to a text file.
- NET USE R: \$IP\C$ /user:administrator password $folder1 = Get-Childitem directory | where { -not $_.PSIsContainer } | group Extension -NoElement | sort count -desc >> C:\Users\me\Desktop\DataFileCount.txt
- #My issue now is changing the array of the table into results I can add into the body of my email
- #I was thinking, if I am not able to break the array down into somthing readable to place in the email, I could send the results to a text file, then Get-Content the file and add that into the email.
- #Mail code
- $SMTPServer = "smtp.gmail.com"
- $SMTPPort = "587"
- $Username = "@gmail.com"
- $Password = "password"
- $to = "@.com"
- $cc = "@.com"
- $subject = "Mail Subject"
- $body = "(the table made above)"
- $attachment = ""
- $message = New-Object System.Net.Mail.MailMessage
- $message.subject = $subject
- $message.body = $body
- $message.to.add($to)
- $message.cc.add($cc)
- $message.from = $username
- $message.attachments.add($attachment)
- $smtp = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort);
- $smtp.EnableSSL = $true
- $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
- $smtp.send($message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement