I recently figured out a way to automatically patch Slack in our environment AND apply a dark theme to any user who wants it. I accomplished this with PowerShell, this Github repository, and PDQ Deploy and PDQ Inventory. If dark mode allows you to see better, cranks your hacker image up to the next level, or maybe you just want to look super cool (trust me, it works), this guide is for you.
And if you're one of these non-dark mode users I keep hearing about, well,
Grab this PowerShell script to automatically apply a dark theme to Slack. Download the file, open up PowerShell, and run it on a test machine to make sure it successfully applies the dark theme to Slack.
The problem with the PowerShell script is whenever Slack updates, the update overwrites the custom theme and reverts back to the standard theme. We need a way to apply the script every time Slack updates. To accomplish this, we're going to grab the 'Auto Download Slack' package from the PDQ Package Library and set up a Schedule.
Fire up PDQ Deploy, download Slack from the Package Library, and create a new Schedule to deploy Slack when it updates. We've covered this before, so here's a guide to get you started if you need help.
Next, we're going to modify the Slack package to apply the dark theme in a Post-Step.
Open up the Slack Package
Select Post-Steps -> New Step -> PowerShell
Click 'Insert PowerShell Script'
It should look something like this:
Make sure you're running Deploy in dark mode, obviously.[/caption]
We don't want to apply the dark theme to every user, just the ones who want it. So let's move over to Inventory and create a static collection of computers that will get the dark theme. That should look like this:
Make sure you're running Inventory in dark mode, obviously.[/caption]
We'll make the dark theme step only apply to computers in that collection.
Go back to your Slack package and select the 'Apply Dark Theme' Post-Step you just made
Open the Conditions tab.
Under 'PDQ Inventory Collection', select 'Is A Member'
Select the new 'Slack Dark Mode' Inventory collection.
It should look like this:
Lastly, let's finish up our Schedule. I have a pretty standard Schedule with a daily trigger to hit machines that usually stay on, and a heartbeat trigger for machines that come online. For Targets, I link to the 'Slack (Per-Machine Install) (Old)' collection. Then, of course, don't forget to attach the Slack package in the Packages tab.
At this point, all you have to do to keep Slack patched is set it and forget it. Your Schedule will effectively kill two Jedis with one lightsaber: keep Slack up to date, and apply the dark theme to any user who wants it.