My new favorite PowerShell Tool: Slack

I have been using Slack for several years now. It is an excellent collaboration tool for teams. At its base, it is great for communicating with teammates. At another level it becomes an IT monitoring hub for alerts, metrics and tools. I have done customization with many different products, utilizing their “bots” to do basic tasks like project management and scheduling. I have configured Solarwinds, a complete infrastructure monitoring suite, to push alerts to multiple channels within Slack. This is a great benefit in an age where, as an IT professional, we get enough spam from co-workers, company announcements and vendors. Alternative notification is a must to stay agile.

Recently i had sort of an epiphany. I knew Slack’s APIs and integrations were abundant and well documented. However, I am not a programmer. What would i do with any of that?
I was tasked with running a PowerShell script i wrote, overnight, to reboot a series of VMs for an application. This process takes a few min to accomplish. Statuses go up, they go down, i am watching from my console and i let the devops team know, via their own Slack channel, when i started and when I was complete. I thought to myself, i wish my script would tell them the status. I immediately had an OMG moment. What a great idea! In bed that night i started researching how this is done. Many people have written different functions and scripts to accomplish this through PowerShell. It isn’t hard, coming up with the idea to do it seemed harder.
The next day I jumped right on this. Building my own function for sending Slack messages through PowerShell. It wasn’t long until I had a simple, but very effective, function I could integrate into my script. I set up the reboot script to notify the Slack channel each time a server was going down, and then when the server was back up. This worked really well. People can get the play by play without me watching, or really being involved at all.

I started thinking about what other use-cases i could come up with for this and it dawned on me; logging. I typically write logs out for scripts i run, especially if the script is going to run awhile. Maybe its a migration script, or changing a lot of x and y. Also, typically someone else is involved as well, maybe another team member and/or my boss. So, again, i have to give the play by play of the progress of the script as it goes. Or i tell them, “look at this text file on this share to see progress”. That isn’t fun.
So, i came up with creating a private Slack channel for the particular script i’m running. I can leave it or tear it down later. Invite the involved parties to the channel and boom!, we all get updated all the time, in real-time. I can even check on it on my phone, on the mobile Slack app. This has changed my PowerShell world. I have a lot of flexibility with these ideas in mind.