Tinus EngOps Wiki

Logo

OpsaC - Operating as PowerShell code

Links

Home

IT-Wiki

PowerShell Blog

PowerShell Index

PowerShell Search

Additional Websites

View my GitHub Profile

View my GitHub Gists

View my Codeberg Page

View my Photo Website

PSTeams

published: November 29, 2020 author: Tinu tags: PowerShell categories: PowerShell-Module


Table of Contents

PSTeams Module

PSTeams is a PowerShell Module working on Windows / Linux and Mac. It allows sending notifications to Microsoft Teams via WebHook Notifications.

Install-Module -Name PSTeams

Prepare MS Teams

Create a Channel in your MS Teams.
Add a Webhook for the Teams Channel.

Send notifications to MS Teams

$TeamsID = 'WebhookURL'

$Fact1 = New-TeamsFact -Name 'OS' -Value "**$($PSVersionTable.OS)**"
$Fact2 = New-TeamsFact -Name 'User' -Value "**$($env:Username)**"
$Fact3 = New-TeamsFact -Name 'PS Version' -Value "**$($PSVersionTable.PSVersion)**"
$Fact4 = New-TeamsFact -Name 'PS Edition' -Value "**$($PSVersionTable.PSEdition)**"

$CurrentDate = Get-Date

$Section = New-TeamsSection `
    -ActivityTitle "**Notification XYZ**" `
    -ActivitySubtitle "@PSTeams - $CurrentDate" `
    -ActivityImage Add `
    -ActivityText "This message proves PSTeams Pester test passed properly." `
    -ActivityDetails $Fact1, $Fact2, $Fact3, $Fact4

Send-TeamsMessage `
    -URI $TeamsID `
    -MessageTitle 'PSTeams - Test' `
    -MessageText "This text won't show up" `
    -Color DodgerBlue `
    -Sections $Section

See also

EvotecIT PSTeams


← Previous Post ◇ [ Top ] ◇ Copyright © 2024 by tinuwalther ◇ [ Blog ] ◇ Next Post →