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.



Leave a Reply

Your email address will not be published. Required fields are marked *