Skip to content

Notifications (Mail & Teams)

The Notify module sends structured notifications (success, failure, reboot) at the end of a deployment, via SMTP and/or a Microsoft Teams webhook. It integrates with TaskSequence.psm1 through configurable hooks.

Configuration

In PSWinDeploy.psd1, section Notifications:

Notifications = @{
    Mail = @{
        Enabled    = $true
        SmtpServer = 'smtp.corp.local'
        To         = @('it@corp.local')
        ToOnError  = @('it@corp.local', 'manager@corp.local')
    }
    Teams = @{
        Enabled    = $true
        WebhookUrl = 'https://outlook.office.com/webhook/xxx'
    }
}

Creating a Teams webhook

  1. In the target Teams channel, open Connectors (or Workflows on newer tenants).
  2. Add an Incoming Webhook, give it a name (e.g. "PSWinDeploy").
  3. Copy the generated URL into Notifications.Teams.WebhookUrl.

Testing the channels

Import-Module .\Modules\Notify\Notify.psm1
Test-NotifyConfig              # All channels
Test-NotifyConfig -Channel Mail
Test-NotifyConfig -Channel Teams

Behavior

Notifications are sent automatically by Invoke-TaskSequence at the end of a deployment (success or failure). If one channel fails to send, the deployment itself is not affected — the failure is only logged.