Resend email if Send-MailMessage returns an error

Using Send-MailMessage command is pretty simple. However there are some situations where it might cause you some problems. I recently noticed that it sometimes returns timeout error – Error in processing. The server response was: 4.7.0 Timeout waiting for client input . To fix it I created simple loop to make 5 resend attempts – it can be useful if you had to add script to a task scheduler. Send-MailMessage …

Check scheduled tasks on localhost or remote servers

In this article we will focus on how to get information about scheduled tasks from localhost or remote machines. Function is based on command Get-ScheduledTask which is available starting from Windows Server 2012 in module ScheduledTasks: Basically we can get information about tasks using above 1 liner but just for fun we can create this function. It will allow us to specify state of tasks which we would like to …

Scheduled task creation using Powershell

Let’s talk today a little bit about how to create scheduled task using Powershell. Windows admins who created big number of task scheduler jobs know that is not very fascinating job. There is a lot of clicking and it’s really boring. So let’s automate it!. First of all you should define $action scriptblock in which your custom script should be pasted and name of the task. In next step job …