Quickly fix SCOM scripts from Exported Management Packs with Transform Tool

Quick Download: https://gallery.technet.microsoft.com/Fix-SCOM-from-Exported-e011ab52
Source: https://github.com/timmcfadden/SCOM-Transform-Tool

Have you ever exported a MP with a script and tried to run it on the command prompt and it fails yet seems to work fine when SCOM runs it.

If I export the MP from SCOM using PowerShell.

Get-SCOMManagementPack -DisplayName "Microsoft SQL Server 2014 (Discovery)" | Export-SCOMManagementPack -Path c:\temp\

Then open it up in NotePad++ and search for the script name. In my case it is DiscoverSQL2014FileGroups.js

Now I copy the script to a file of its own and try to run it on my SQL 2014 server. I use the command line from above

"C:\Windows\system32\cscript.exe" /nologo "DiscoverSQL2014FileGroups.js" "{2B758984-7383-2601-C53C-2CA0230DD4A4}" "{0A0C96F4-897D-F150-06EE-9BF68EF9C18D}" "DB12.SCOM2K16.com" "DB12" "MSSQLSERVER" "1433"

But I get a script error.

The issue is the exported mp changes some of the characters in the script. So we need to change the characters back so we can run it manually.

With the Transform Tool I copy and paste the script. Then I hit Unescape.

I copy the updated code and take a look at it. I can see that it changed the characters back to what they should be.

I run the script on the SQL server and it now works.

3 Responses to Quickly fix SCOM scripts from Exported Management Packs with Transform Tool

  1. Igor Kuznecov August 21, 2018 at 8:43 am #

    notepad++ can do it with xml plugin…

Trackbacks/Pingbacks

  1. Awesome new transform tool available for testing SCOM scripts from MP’s – Kevin Holman's Blog - December 28, 2018

    […] https://www.scom2k7.com//quickly-fix-scom-scripts-from-exported-management-packs-with-transform-tool/ […]

  2. SCOM Tools – Kevin Holman's Blog - January 24, 2019

    […] https://www.scom2k7.com//quickly-fix-scom-scripts-from-exported-management-packs-with-transform-tool/ […]

Leave a Reply