Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. $Directory=Get-ChildItem "C:Reports" -Directory
  2. $Cred = Get-Credential
  3. Foreach($d in $Directory) {
  4. Write-Host "Working on directory $($d.FullName)..."
  5. $files=Get-ChildItem -Path "$($d.FullName)"
  6. cd $d.Fullname
  7. Send-MailMessage -From "vallabhherlekar@gmail.com" -To "vallabhherlekar@gmail.com" -Subject "test" -SmtpServer "smtp.gmail.com" -Port "587" -Attachments $files -BodyAsHtml "test msg" -Credential $Cred -UseSsl
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement