FIXED: Get-SCOMManagementPacks.ps1

If you are unfamiliar with this script, it automatically downloads the Microsoft Management Packs and their Guides for Operations Manager in nice folders. Not sure how many people use this script or not, but I have noticed an increasing trend “null” error for a while. So I figured I would dig deeper into this and see if I could resolve the errors.

Related URLs:

Original Git Repo:

v4 Git Repo:

Stanislav's blog post:

Damian Flynn's blog post:

Technet Gallery post (v3.0.1):

Stefan Stranger's blog post which started it all:

What is the Issue?

When the PowerShell script is executed, majority of the management packs error out and output the following error.


It is complaining about a “null” value, which both the “Version” and the “Published” lines showing absolutely nothing. when you go to the download pages, both are listed.


So I started to debug the PowerShell script and try to find out where the breakdown was located. Working from the line 479 I was able to trace it all the way back to line ‘256’. The script ‘$HTTPData’, kept returning a false/null value. So taking the ‘$URI’ value I was able to validate the Management Pack download page was correct and working.


I started to debug the page and located the “Version:”, right away I noticed that the ‘</span>’ was no longer part of the page.


So then I removed the ‘</span>’ from the script and encountered no change in error when I ran the script. Frustrating!!!

Essentially it should be working, so then I wanted to dig a little deeper to see exactly what the “PageData” is showing. I debugged and placed my breakpoint at line 267, then ran the script; when it stopped, I typed ‘$HTTPData.PageData | clip’ and pasted it to notepad for a deeper look in what exactly is it showing.


I found for the “Version:” and “Published:”, and look at that, I saw that there were a lot of white-spaces between “Version:” and the “</div> as well as the “Published:” line. I copied all of the spaces and inserted it into the script. When the script ran, it worked, the pages that had the “null” error no longer did and the ones that didn’t have the issue now do. So what’s different? they must be older pages that have not been updated to the newer format maybe.


I then I backed tracked and looked at one that now was broke. They still have the ‘</span>’ in the “PageData”


so I placed the original  ‘$HTTPData’ lines with the ‘</span>’ below like so.


Ran the script once more out of debug mode of course, all the errors were gone with the exception of one, which I address later on.

Not enjoying all the spaces in the two ‘$HTTPData’ lines, I wanted to fix this since in the future who knows if a space(s) will be removed or added, in turn breaking again.

Let’s fix it now…

I found the expression I need to match the white-spaces, but when I applied it, I got the errors again.


So the next thing I added was a wildcard ‘*’ after the ‘\s’, so it looks like this now. Wasn’t even sure that the “*” would even work.


Now when I run the PowerShell script it works beautifully!


So just make these changes to your scripts and you’ll be fine.

I can’t update the GitHub script, so hopefully it will get updated soon.

You’ll be able to get it here:

Known Issue:

BizTalk Server 2013 R2 will continue to error out due to an “invalid” date, since the format is different that all the other management packs. but it should still download, however, I did not test this.

BizTalk Server 2013 R2                   7.0.2008.0                02/19/2015


So there you go.