I'm looking to create a PowerShell script that creates an Outlook rule which delays any email sent out by one minute.
I have very limited PowerShell knowledge and cannot find much information on this.
Here's what I have so far:
$olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
$outlook = New-Object -ComObject outlook.application
$namespace = $Outlook.GetNameSpace("mapi")
$rules = $outlook.session.DefaultStore.GetRules()
$rule = $rules.Create("1MinDelay",$olRuleType::OlRuleSend)
$date = Get-Date
$date = $date.AddMinutes(1)
$mail.DeferredDeliveryTime = $date
$rules |
Sort-Object -Property ExecutionOrder |
Format-Table -Property Name, ExecutionOrder, Enabled, isLocalRule -AutoSize