Question

Currently scripting for SCCM to automate

  • creation of collections

  • populating collections

  • etc..

I'd like to add a "verification" step.

I want to ensure (through commandline since I want to automate it) that a Deployment Type has at least one Global Condition.

I searched

Could I find a commandlet that would do the trick ?

  • a way using WMI : Get-WmiObject -list -Namespace root\sms\site_[sitecode]

Could i find a class that would give me the information ?

  • a WQL

I found two information :

  • whether a Global Condition is in use or not : interesting but not quite useful in my case

  • the Global Condition name(s) can be found using Get-CMDeploymentType -applicationname [AppName]).SDMPackageXML

My Global Conditions have not all the same prefix. So the following might work in some case but can not be trusted : PS P41:\> (Get-CMDeploymentType -applicationname PKG_10).SDMPackageXML -match "GC_"

That is where I need a little help. What am I missing ? Which WQL query would give me the information/confirmation I need ?

Was it helpful?

Solution

Found the solution ! I kept digging in the TechNet and found two things :

  • how to deserialize
  • my choice of words was bad : when speaking about Deployment Types, we do speak no more about Global Conditions but about Requirements

In the end, I solved my need with the following : ([Microsoft.ConfigurationManagement.ApplicationManagement.Serialization.SccmSerializer]::DeserializeFromString((Get-CMApplication -name AppName).SDMPackageXML)).DeploymentTypes.Requirements.Count

Of course, if there are more than one Deployment Types, ([Microsoft.ConfigurationManagement.ApplicationManagement.Serialization.SccmSerializer]::DeserializeFromString((Get-CMApplication -name winzip_FR_1.5.0_R1.000).SDMPackageXML)).DeploymentTypes[n].Requirements.Count

Well, thanks,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top