clarkd 1.15K Rep.

I’m trying to setup a SCOM Command Channel that runs a PowerShell script (to send a Slack message) every time an alert from specific servers fires.

I have the channel setup and the script works fine but it just doesn’t seem to be working. There’s no output in event viewer and I don’t receive any messages. I’ve tried adding >> C:\DC\log\log.txt to the end of the parameters to try and get some output but nothing gets saved (I’ve given Everyone permission to write to that directory temporarily).

Does anyone know how else I should go about debugging the channel?

The command channel is configured as follows:

Full path of the command line

Command line parameters

Startup folder

RB commented
    • I am only on my phone so I cannot try your channel my self, but I have done the same thing to msft teams. See if you can get anything out of this http://adatum.no/operationsmanager/scom-alerts-to-microsoft-teams-and-mattermost
    • The issue could with the "executionpolicy". If you have a GPO that has set the executionpolicy you cant change it. Have you checked out this link: https://social.technet.microsoft.com/Forums/windows/en-US/fab60a50-d697-4f25-ac9b-bf767be5d0b1/scom-2012-command-channel-not-executing-commands?forum=operationsmanagergeneral ?
    • You should check out the Event Log for Microsoft-Windows-PowerShell/Operational as well, see if any errors or warnings are present. Check that the Powershell file is unblocked depending on your version of Windows, go to the file right click on properties. Try changing the Startup Folder to C:\DC remove the last \ When you say you know the script works, did you test it the way SCOM runs it? Open Command Prompt, CD to the startup folder, and run the full… Continue reading
    • Have you tried paring the script back to a hello-world script (that just writes to a file, for example) to test the basics are working? You could then also try removing the arguments from the notification channel until you're down to the most basic powershell command. Hopefully that will help track down which piece is breaking. Also BTW I suspect you can't do >> log.txt as SCOM will probably be using ShellExecute to execute this command (not cmd.exe).