I have been working on this very cool Project latley where I needed to make a exact complete copy of a ConfigMgr 2012 infrastructure to another, this on a regular Basis.

The approch was the following: Using Orchestrator we would Read the informations out using SQL queries, and then write them in the Destination Environment using Windows PowerShell and WMI.

I’ll describe you here one particular part which was how to copy the ConfigMgr WSUS sync Options (Classifications and Products).

1) Get the information through SQL

Have a look here to see how I got the information from SQL

2) Set the ConfigMgr Software update sync Settings using WMI and PowerShell

Now that we have our data, we Need to set it in our Destination Environment. If there is one Thing that you should do before every Task that is asked to you to do: you should Google it! Using my crazy Google fu skills, I found a good base to start of from . A function located in a script from Nial Brady which is avaible here.

I have extended the original Set-SupProductSubScription function previously created by Nial Brady (available here)

I have extracted the function that I was interested in here and put here here under.

Continue to read to find an inproved version of this function at the end of this post

As you can see, the original function was getting the correct Instance (read product to set or not) via it’s CategoryInstanceName property.

The first thing that happended to me was Silverlight. Yes, Silverlight.

As you can see, Silverlight is actually present twice in the ‘products’ Settings of the Software update sync Settings: 1 as a product Family, once as simple product.

WindowsLive Case 2

I have then modified the original function to take the CategoryInstance_UniqueID As a parameter and called like below.

 

So, I added a filter on the CategoryTypeName, which resulted in the following function

Again, read until the end of this post to get the full Version of this function.

Using the CategoryTypeName actually worked well. But then, Windows Live Happend…

Yes, Windows Live… As opposed to Silverlight which was present only once in the product family, and once in the products, Windows Live is actually present twice as a product. See by your self:

Number 1:

2016-02-25_18-53-09

Number2:2016-02-25_18-51-45

So simply filtering on the InstanceName AND the CategoryTypeName simply wouldn’t work anymore since It would not know which one of the Windows Live it should use.

If we have a closer look at their properties, we will notice a property called CategoryInstance_UniqueID

The case of Windows Live

As showed on the picture above, even though we have the same CategoryInstanceName and the same CategoryTypeName, the CategoryInstance_UniqueID, will remain like it’s name implies it: unique.

I adapted the original function to take the CategoryInstance_UniqueID as an input, and called the function like this:

And we can see the results here under. (Choosing a product family will actually set all of it’s child items as well).

2016-02-25_19-30-32

 

Here is the latest version of the function: