Category Archives: PowerShell

Send a HTML email with PowerShell

There’s a simple one-liner (expanded onto multiple lines for clarity) in PowerShell that allows you to send an email with HTML content derived from a HTML file: Send-MailMessage -Subject “Test email” -To “recipient@contoso.com” -From “me@contoso.com” -SmtpServer mail.contoso.com -BodyAsHtml (Get-Content “d:\templates\invite-template.htm” … Continue reading

Posted in PowerShell | Leave a comment

PowerShell: Cancel all print jobs

Here’s a quick PowerShell script I put together to delete all print jobs from our Windows Server 2008 R2 print server. It’s run overnight as a scheduled task. We do this because sometimes our print accounting software doesn’t clear out … Continue reading

Posted in PowerShell, Scripting, SysAdmin | Tagged , | 2 Comments