I did a post bacin February 2008 on running a PowerShell script from a management pack.  This was prior to the native PowerShell modules that came with Operations Manager R2 and that I wrote about on a separate post.  The original information is still valid though since it is the method you need to use if you want to run PowerShell scripts in an SP1 environment.  Until Operations Manager 2007 SP1 is no longer supported, there will be reasons to keep using this method.

I just had some good feedback sent to me identifying some issues with that original post.  Since I understand that people still refer to that information, I went ahead and modified it to include those corrections.

Specifically, the following changes have been made:

  • Changed the command line with the following:
    • Set the execution policy
    • Add the Arguments parameter
    • Fixed some syntax. 
    • Fixed the incorrect statement that CDATA cannot be used for the command line.
  • Uses the parameter for IntervalSeconds rather than a fixed value.
  • Changes the RequiresOutput element to True.