title: Getting Child Items of SCCM 2012 Global Conditions using PowerShell
body: <p>I've been searching for DAYS and while I have a laundry list of a dozen different ways to MAKE Global Conditions in PowerShell, what I'm looking to figure out is if there is a better way of making an "Expression Tree" out of my Global Conditions from SCCM 2012 in PowerShell.</p>
  
  <p>I have a small collection of Global Conditions I have defined for Application Requirements and some of them are based on combinations of other Global Conditions. e.g. </p>
  
  <ul>
  <li>Work Stations X64 (All Windows 7 SP1 - Windows 10 X64 Operating Systems)</li>
  <li>Servers X64 (All Windows Server 2008 R2 - 2016)</li>
  </ul>
  
  <p>And a Global Condition based on the previous two</p>
  
  <ul>
  <li>All Systems X64 (Work Stations X64 OR Servers X64)</li>
  </ul>
  
  <p>So using the <code>Get-CMGlobalCondition</code> Cmdlet I can get a list of all my Global Conditions I can also use the optional -Id, -Name, to get a specific Global Condition</p>
  
  <p>The problem is that the only reference that each Global Condition object has for its children (Accessed via the SDMPackageXML property ) are </p>
  
  <ul>
  <li>AuthoringScopeId</li>
  <li>LogicalName</li>
  </ul>
  
  <p>Neither of which work for the Id (Needs the CI_ID) or the Name (Needs the LocalizedDisplayName) of <code>Get-CMGlobalCondition</code></p>
  
  <p>Obviously I can write some code to just parse through the entirety of the Global Conditions collection over and over and build out my expression tree but I'd rather just do what I would do for any other Parent-Child based hierarchy of data and apply some old fashioned recursion to it but without the parent having a property for each child that easily passes to the Cmdlet I'm stuck with this way.</p>
  
  <p>I'm not against using direct WQL if there's nothing in the PowerShell Cmdlets for SCCM.</p>
  
  <p>Just in case anyone asks this is to go along with import scripts that update our UDI Wizard and it's associated .xml.app file (including translating Global Conditions from SCCM into Delivery Rules in UDI)</p>