You probably have many collections each of which contain one or more query in order to populate each collection. Additionally your programs may have requirements set on them as well. These options are available to make sure that software will successfully install and at the same time allows you to target the appropriate users and devices that are applicable to install the software. However, now that the app model allows you to set requirements for apps to install why would you leave the software requirements portion of your targeting intent in your collection queries? In this new model you can concentrate on making sure that the right users and devices are targeted with an app rather than building tons of collections and queries to make sure the user's machine has the minimum amount of disk space, memory, and operating system to run an application being deployed.

Package Conversion Manager (PCM) makes it easy to move to this new model by allowing you to convert your collection queries at the same time as converting your packages to app model applications. In this blog post we will walk through some examples of collection queries and program requirements being converted into global conditions or requirements and finally what the finished product looks like with requirement rules added to your application.

Collection Queries

First lets walk through a couple of collection queries which we will use to convert to global conditions and requirement rules and how these queries are chosen for conversion during the process. When an application is selected for the fix and convert process, Package Conversion Manager will interrogate the collections that the package's program(s) are deployed to in order to present the PCM admin doing the conversion with a list of queries which can be converted to global conditions and requirement rules.

Say for example there is a collection which contains a couple of queries used to populate the collection.

One for adding devices which contain 2 processors:

select R.ResourceID,R.ResourceType,R.Name,R.SMSUniqueIdentifier,R.ResourceDomainORWorkgroup,R.Client from SMS_G_System_COMPUTER_SYSTEM as G inner join SMS_R_System as R on G.ResourceID = R.ResourceID where G.NumberOfProcessors = 2

The other collection query for adding a computer with a specific name:

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_SYSTEM where NetBiosName = 'pcmdemo'

 

Of course you probably have queries which are a lot more complex, but these are just a couple of simple examples of collection queries which can be converted. We will discuss how these queries will be converted when we discuss the fix and convert process below.

Note: Not all queries can be converted and I have added a few examples of queries which can't be converted in the FAQ section below.

Program Requirements

Now that we have briefly covered a couple of collection queries which can be converted let's talk about one other piece of information which can be converted. If you have set OS requirements on programs PCM will allow you to also convert these requirements to the app model. Below is an example of a program requiring any 64 bit Windows 7 OS which can be converted over to the app model. 

We will walk through how this requirement can be converted below when we walk through the Fix and Convert process.


Fix and Convert - How to move collection queries and program requirements to the app model

In this section we will walk through how the above collection queries and program requirement can be converted into global conditions and requirement rules using PCM's Fix and Convert wizard and where these requirements land in the app model after the conversion. Now let's walk through converting the above queries to global conditions and requirement rules at the same time as we convert a package and its program(s) to an application and deployment type(s).

The first thing you will do is find and select the package that you would like to convert to the application model. It is important to remember that collection queries are only converted to the app model while converting a package which contains one or more programs which are deployed to the collection containing queries. Likewise requirements will only get converted if a package's program(s) contain OS requirements. Of course you could also manually set these up, but PCM does this automatically for you when converting your packages to applications using the Fix and Convert Wizard. The important thing to understand is PCM doesn't provide a way to convert collection queries or program requirements outside of converting packages to applications. Additionally you may be thinking that the fix and convert wizard is only for converting those applications which are broken or have a state of manual, but this isn't always the case. If you want to convert your collection queries or program requirements into global conditions and requirement rules then you will need to use the fix and convert wizard.

Once you have identified the package that is tied to a collection query or OS requirement that you would like to convert you can select the Fix and Convert option from either the ribbon item or right clicking menu.

Walk through the wizard which will display until you get to the Requirement Selection page. From this page you can select each of the programs which will be converted to deployment types in order to select the collection queries and program requirements that will be converted to global conditions and requirement rules. Below is an example of the page which is displayed allowing you to select the different collection queries and program requirements available from each program.

 

From this page you can pick and choose which collection queries and Program Requirements you would like to convert during the conversion process. Once you select the queries and requirements you would like to convert and finish out of the wizard, PCM will create the applications, Deployment Types, Global Conditions and then add these as requirements to the converted Deployment Type(s).

Additionally if we look at the global conditions after the conversion process completes for the above application we can see that a custom global condition has been created from the NetBIOS Name collection query.

Additionally if we open up the converted application we can see that the collection queries and program requirements which we selected and created during the conversion process all show up as requirements on the application.

Note: If you analyze a package and it has a readiness state of automatic you will still need to use the fix and convert wizard in order to convert the collection queries and program requirements to global conditions and requirement rules. I know that I stated this above, but thought it was important enough to mention again. 

FAQ

In this section I have added a few FAQs specific to converting collection queries and requirement rules along with their answers.

Will PCM successfully convert multiple programs with different OS requirements and attach the appropriate requirements to the appropriate DTs which were converted?

When walking through the fix and convert wizard the requirement selection page will allow you to select a DT, which will be created from the program, and then allow you to select the requirements which you would like to convert and add to the deployment type's requirements. Yes, you can pick and choose which requirements to add to each of the deployment types and these will get added.

Which Collection queries will not be converted?

Here are a few examples of queries which won't get converted as they really don't tie to software requirements and shouldn't be converted to global conditions or requirement rules:

  • Select * from SMS_R_UnknownSystem where Sitecode = 'abc'
  • select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SystemGroupName = 'abc'
  • select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where LastLogonUserDomain = 'Redmond'
  • select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMSAssignedSites = 'ABC'

There are also queries which can't be converted as deconstructing the queries would be very difficult. One example of this type includes queries which contain multiple select statements.

Additional there are keywords which PCM doesn't support in queries:

  • Sort By
  • Ascending
  • Descending
  • Is Not Null
  • Within
  • Group
  • In

What happens if I already converted a collection query to a global condition and then convert another package\program which is deployed to the same or different collection which contains the same query?

Regardless if a collection query is on one or multiple collections it will only be converted once. If you convert a second application which is deployed to a collection containing that same collection query the previously converted global condition will be added as a requirement to the converted deployment type.