Send a notification to Teams
This Agent Procedure will send out a notification to a webhook when it has run. I use this to notify a channel when a device is online again, after a Windows Upgrade or when a device has been lost. A sample text has been added for that.
The Agent Procedure was made for Teams webhook, but should work for Slack webhook too.
Works! I followed the instructions from Microsoft to create the webhoook. I edited the first line of code in the script. This is line 2 which is the first getvariable command. It has 5 options in the command. I put my URL from the webhook in the first type-able field without any extra quotes or anything. Saved and tested on an offline VM. Brought the VM online and got a MS Teams notification on. This will be nice when you really just need that extra look out on a machine.
Just a quick FYI. Invoke-Restmethod (which really open a wealth of opportunity for integration, think Microsoft Flow..) requires a minimum of PowerShell 3.0. Some Windows 7/2008 boxes might be outdated. You can use a procedure to grab the PS version and update to a custom field (example below). You can then run a procedure on that View to upgrade the PS version. If needed i can provide such a procedure.
($PSVersionTable.Psversion | Select-Object major | ft -HideTableHeaders | Out-String).trim()