Lennart Giaccotto
asked on
Powershell output to email works, but readability is low
Hi there,
I've made a script which tells us which accounts will expire in the coming 2 weeks. This will be send through mail and will be scheduled. the mail part works, but the result is not easy to read. For this i wanted to make a html mail, maybe using a table (?) but i can't seem to get this working using my current script:
Can someone point me in the right direction?
I've made a script which tells us which accounts will expire in the coming 2 weeks. This will be send through mail and will be scheduled. the mail part works, but the result is not easy to read. For this i wanted to make a html mail, maybe using a table (?) but i can't seem to get this working using my current script:
$myData = Search-ADAccount -AccountExpiring -TimeSpan "14" | Select-Object Name,AccountExpirationDate | Sort-Object AccountExpirationDate|convertto-csv -notypeinformation
Send-MailMessage -From xxx@xxx.nl -to xxx@xxx.nl -subject "Accounts about to expire" -SmtpServer xxx.xxx.local -body "$mydata"
Can someone point me in the right direction?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Guys, The small script did the job!
The other script adds some styling, but the -BodyAsHtml option is missing.
Open in new window
https://technet.microsoft.