Introduction
I’m kind of continuing on last weeks topic, where I wrote about leveraging SetupConfig.ini and SetupComplete.cmd to carry out custom tasks during a Windows 11 Feature Update.
Today I want to demonstrate, how you can leverage the same custom action scripts, to send notifications to a Microsoft Teams channel upon success or failure, when upgrading to Windows 11 using a Feature Update.
I’m still preparing Windows 11 for broad deployment and I will post my exact process once it’s ready. For now I’m just giving you tiny tidbits along the way. 🙂
Preliminary details
As I also mentioned last week, this post assumes some knowledge on SetupConfig.ini as well as SetupComplete.cmd and custom action scripts in general.
I will elaborate greatly on these topics in a near future, covering my Windows 11 process, but for now you should hit up the topics on your favorite search engine and start reading. Below is something to get you started:
- Windows Setup Automation Overview | Microsoft Docs
- Run custom actions during a feature update | Microsoft Docs
PowerShell
I’ve extended the script (FU-Script.ps1) I created last week, with the ability to send notifications to a Teams channel.
- NOTE: The content here are light versions of the final products of my Windows 11 process. For now, I’m only including the content relevant to the topic of the blog post.
FU-Script2.0.ps1
This is still the one and only script you need to get started!
This script still creates the SetupConfig.ini file, as well as any of the custom actions scripts used: SetupComplete.cmd as well as PostRollBack.cmd and the corresponding PowerShell references.
The script is located here on my GitHub repository: Windows-11/FU-Script2.0.ps1 at main · imabdk/Windows-11 (github.com)
- NOTE: I bumped the version to 2.0, but in a separate file to keep the history of last weeks post.
The script still does all the things that last weeks post described, so I’m not covering those in details again. Read this post for complete details:
SetupComplete.ps1
SetupComplete.ps1 now has a Teams message card section.
- Configure $sendStatusTeams to $false if you don’t want to send notifications to Teams.
- Configure $webhookUri with the incoming webhook URI generated in Teams channel connector (I’ll elaborate in a bit)
PostRollBack.ps1
PostRollBack.ps1 now has a Teams message card section.
- Configure $sendStatusTeams to $false if you don’t want to send notifications to Teams.
- Configure $webhookUri with the incoming webhook URI generated in Teams channel connector (I’ll elaborate in a bit)
Configure Teams Channel
When you have decided what Teams channel your notifications should go to, you need to configure an incoming webhook connector. You do so by following few steps:
- Click on the 3 dots (…) next to the channel name
- Click on Connectors in the menu:
- Give it a name, upload an image (not required) and copy the URL
- Paste and replace the webhookURL into the $webhookURI variable in respectively the SetupComplete.ps1 area as well as the PostRollBack.ps1 area in the FU-Script2.0.ps1 script.
Results
The results on a succeeded as well as a failed/rolled back Feature Update, is a notification similar to below sent to your Teams channel.
ENJOY 🙂