“PowerShell Script failed to run” alert in OpsMgr 2012
Don’t you hate it when you’ve just released a piece of work to public and you found an issue with it? Well, this is what happened to me today. Yesterday and released the OpsMgr Self Maintenance MP, and today, I found an issue with the 2012 version.
After the MP is imported and the “OpsMgr 2012 Self Maintenance Operational Database LocalizedText Table Health Monitor” has been enabled via an override, you’ll soon get this alert from one of the management servers:
The PowerShell script failed with below exception
System.Management.Automation.IncompleteParseException: White space is not allowed before the string terminator. at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input) at Microsoft.EnterpriseManagement.Common.PowerShell.RunspaceController.RunScriptT
After spent sometime troubleshooting, the issue is a bit stupid, but I’ll remember this in the future:
I wrote the 2007 version using 2007 R2 authoring console, thus no problems found. The 2012 version was written using Visual Studio Authoring Extension. In the particular probe action module used by the monitor type, this is what the raw code looks like:
when I pasted the script in the xml, I tried to format it using the Tab key.
This is what it should look like:
After I removed all the Tab spaces, the monitor started working.
I’ve changed the version number of the 2012 version to 1.0.0.1. I’ll update the MP from the original article from yesterday. For those who has already downloaded the MP, apologies. please download it again and the mp can be in-place upgraded to the new version.
Leave a comment