Thursday, April 9, 2015

SCOM 2012 R2 Command Notification Channel using PowerShell Fails


This issue may be common but I couldn't find any information on the different SCOM blogs hence I decided to post it.

Problem:
I added a second Management Server (MS) to my lab management group.
I have some Command channels that execute different PowerShell scripts copied locally on the RMSe which are triggered by an event rule.
The trigger rule was being generated successfully but the PowerShell scripts did not get executed.

Solution:

1. The new MS is automatically added to the “Notification Resource Pool” therefore it needs the same scripts copied locally. (Same folder structure for both MS servers)





2. The Notifications account needs appropriate permission on the folder/share where these scripts are stored to execute them.




3.  To maintain the same information on both Script shares I have created a batch file with a Robocopy command which is executed weekly via a Scheduled Task




       Command in Batch file:
       robocopy "C:\SCOM\ScriptFolder" "\\MS2\C$\SCOM\ScriptFolder" 
       /E /ZB /X /PURGE /COPYALL /TEE /LOG:E:\Copy_from_HD_to_Ext_HD.log

       Meaning of switches used in above command explained below

         /E :: copy subdirectories, including Empty ones.     

        /ZB :: use restartable mode; if access denied use Backup mode.

       /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).

       /PURGE :: delete dest files/dirs that no longer exist in source.

       /X :: report all eXtra files, not just those selected.

      /TEE :: output to console window, as well as the log file.

      /LOG:file :: output status to LOG file (overwrite existing log).



      Thanks to ITBloggerTips for posting this very useful Robocopy command!!

     http://itbloggertips.com/2013/05/robocopy-command-copy-only-new-changed-files-sync-both-the-drive/


Disclaimer:
The information is provided “AS IS” with no warranties. Use at your own risk!


2 comments:

  1. Could you also configure your scripts folder with DFSR and let DFS replicate the contents whenever a change is made on any of the member servers?

    ReplyDelete
  2. Hi Steve,

    I suppose you could do that. That way you can make changes on either share and be replicated but I have not tested that approach.

    Thanks

    ReplyDelete

SCOM and Orchestrator Voice Notification Solution with Twilio and Automys

SCOM and Orchestrator Voice Notification Solution with Twilio and Automys. Cherry Picking SCOM alerts… Problem: Issue # 1 : Spam (a...