PSTeams is a PowerShell Module working on Windows / Linux and Mac. It allows to send notifications to Microsoft Teams. It's pretty flexible and provides a bunch of options.
For description and advanced usage visit PSTeams dedicated page.
While I didn't spent much time creating WIKI, working on Get-Help
documentation, I did write 3 articles that should help you get started.
- PSTeams – PowerShell Module
- PSTeams – Send notifications to MS Teams from Mac / Linux or Windows
- Sending Messages to Microsoft Teams from PowerShell just got easier and better
-
1.0.1 / 2020.07.28
-
1.0.0 / 2019.12.22 - full blog post
- New way of sending to Teams, old way still works
- Added new aliases
- Reworked lists/list items creation
- Removed Enums in favour of ArgumentCompleters with strings.
- Changed 149 colors into 800 (+-) colors (same as PSWriteHTML)
-
0.6.0 / 2019.04.12
- Stability issues
-
0.4.0 / 2019.04.03
- fix for UTF-8 charset - (provided by hjorslev)
- emoji support added - (provided by hjorslev) - to use it you may need UTF-8 with BOM file encoding
-
0.3.x / 2019.02.21 -[x] added summary for message that is visible in Activity pane
-
0.2.x / 2018.10.04 - full blog post
- added cross-platform (works on linux, mac os, windows)
- added azure pipelines
- added some pester tests
-
0.1.x / 2018.07.12 [x] first release
This module uses Message Cards to send information to Teams. You can find out what is supported in Legacy actionable message card reference just in case you would like to help out with development of this module.
Additional links:
- https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/cards/cards-format
- https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference
Send-TeamsMessage -Verbose {
New-TeamsSection -ActivityTitle "**Elon Musk**" -ActivitySubtitle "@elonmusk - 9/12/2016 at 5:33pm" -ActivityImageLink "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0.jpg" -ActivityText "Climate change explained in comic book form by xkcd xkcd.com/1732"
New-TeamsSection -ActivityTitle "**Mark Knopfler**" -ActivitySubtitle "@MarkKnopfler - 9/12/2016 at 1:12pm" -ActivityImageLink "https://pbs.twimg.com/profile_images/1042367841117384704/YvrqQiBK_400x400.jpg" -ActivityText "Mark Knopfler features on B.B King's all-star album of Blues greats, released on this day in 2005..."
New-TeamsSection -ActivityTitle "**Elon Musk**" -ActivitySubtitle "@elonmusk - 9/12/2016 at 5:33pm" -ActivityImageLink "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0.jpg" -ActivityText "Climate change explained in comic book form by xkcd xkcd.com/1732"
} -Uri $TeamsID -MessageSummary 'Tweet'
Install-Module PSTeams
#Install-Module PSTeams -Scope CurrentUser
#Update-Module PSTeams
$TeamsID = 'YourCodeGoesHere'
$Button1 = New-TeamsButton -Name 'Visit English Evotec Website' -Link "https://evotec.xyz"
$Fact1 = New-TeamsFact -Name 'PS Version' -Value "**$($PSVersionTable.PSVersion)**"
$Fact2 = New-TeamsFact -Name 'PS Edition' -Value "**$($PSVersionTable.PSEdition)**"
$Fact3 = New-TeamsFact -Name 'OS' -Value "**$($PSVersionTable.OS)**"
$CurrentDate = Get-Date
$Section = New-TeamsSection `
-ActivityTitle "**PSTeams**" `
-ActivitySubtitle "@PSTeams - $CurrentDate" `
-ActivityImage Add `
-ActivityText "This message proves PSTeams Pester test passed properly." `
-Buttons $Button1 `
-ActivityDetails $Fact1, $Fact2, $Fact3
Send-TeamsMessage `
-URI $TeamsID `
-MessageTitle 'PSTeams - Pester Test' `
-MessageText "This text won't show up" `
-Color DodgerBlue `
-Sections $Section
- When executed from Linux
- When executed from Windows
- When executed from MacOS
- And this is more advanced option sent by PSWinReporting