Guest User

Untitled

a guest
Jul 19th, 2019
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data