Send messages to teams

When automating with scripts you often (or allways) want to log what the script are doing.

And mabye you want a message from the script.

Teams is the new “cool” and nice way to communicate with your colleagues.
So It would be nice to use it to send messages instead of old mails right?

But It will be hard to set up and hard to script?


It’s a 2 min setup and under 5 lines of PowerShell code 🙂

Just go to your team.
Create or use an existing channel.

Go to Options for that channel, Connectors, Add Connector, Search for Incoming Webhook.

Provide a name for the Sender and If you want an Image.

Click “Create” and then you will get an URI.
Click on the copy button.

And then you need this code to send a message to you teams channel:


And the message in Teams:

1 Response

  1. jkavanagh says:

    Nice… Still lacks something. I used a here-string to test sending some longer messages. URLs don’t appear to be picked up (I.e. no preview). It will be interesting to see what fields are available via REST.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.