Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 0.52 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Powershell: how to format Get-Childitem for email?
  2. $mailbody += "<p>" + (get-childitem $path | select-object Name | Out-String -width 40) + "</P>"
  3.        
  4. get-childitem $path | select-object Name | ConvertTo-Html -fragment
  5.        
  6. $path = "C:"
  7. [string] $html = dir $path | ConvertTo-Html
  8.  
  9. $smptServer = ''
  10. $to = ''
  11. $from = ''
  12. $subject = 'Test'
  13. Send-MailMessage -To $to -From $from -Body $html -BodyAsHtml -SmtpServer $smptServer -Subject $subject
  14.        
  15. [string] $html = dir $path | Select Mode, LastWriteTime, Length, Name | ConvertTo-Html