Import-Module Error Message from a PowerShell Script for a Recovery Task in SCOM 2012

While working on a PowerShell script to Reset the Health State of a monitor (as a Recovery Task) in SCOM, my script kept returning the following error message while still succeeding. A Screenshot is also included further down.


The Script Code is shown below:


As of August 15, 2012, PowerShell 3.0 is only available as part of the Windows Management Framework 3.0 – RC package. Interestingly enough, the Cross Platform cmdlets that are available in SCOM 2012 require PowerShell 3.0 or greater in order to function properly. Why Microsoft decided to include Cmdlets with SCOM 2012 that requires software that is still in RC, I leave to you to figure out.

The reason that this particular scenario is affected is because of importing the OperationsManager module at the beginning of the Script. By default, when you import theOperationsManager module the Cross Platform cmdlets will attempt to load as well. As the Cross Platform cmdlets are called to load from the OM10.CrossPlatform.Start.ps1Script, the version of PowerShell is first checked before loading the modules. As PowerShell 2.0 is in use by default in SCOM 2012, the check fails and the error message shown above is the result.

Below is a breakdown of the pieces that are involved in the process just described.

The Import-Module cmdlet initially calls for the OperationsManager module which is installed in the following path of which ever Drive Letter you installed SCOM.

Within this directory there are Five PowerShell files that are loaded when the OperationsManager Module is called:

Within the OM10.CrossPlatform.Start.ps1 Script, there is one particular section of the script that checks the existing version of PowerShell that is in use by SCOM:

Within the OM10.CrossPlatform.psd1 module, the minimum PowerShell version required is defined as follows:


In order to make the error message go away, both the OM10.CrossPlatform.Start.ps1 and OM10.CrossPlatform.psd1 file(s) need to be modified.

OM10.CrossPlatform.Start.ps1 changes

Change the line in the script which checks to see if the version of PowerShell you are running is greater than or equal to 3.0. Since we are changing the int value to 2, the existing PowerShell 2.0 installation will pass.

Original Code:

Modified Code:

OM10.CrossPlatform.psd1 changes

Change the minimum version requirements in this module from 3.0 to 2.0.

Original Code:

Modified Code:

After making these changes, I reran the Recovery Task again which returned back the correct response:



Any suggestions or alternatives to the method described herein is greatly appreciated!

One thought on “Import-Module Error Message from a PowerShell Script for a Recovery Task in SCOM 2012

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.