3
PS sss:\> $match.ApplicabilityCondition

<ApplicabilityRule ExpressionLanguage="Custom" Handler="{2DB70103-3DFB-4806-85B0-B27B561284BB}"><UpdateId>3a50171e-f09b-46fd-991c-ffa0c1fabcc6</UpdateId><CISource><Id>{7ABE2526-ED91-47AE-A989-275B4B2924FE}</Id><Version>188</Version></CISource><ProductId>704a0a4a-518f-4d69-9e03-10ba44198bd5</ProductId></ApplicabilityRule>

ApplicabilityCondition is an XML-like object that is returned as part of Get-CMSoftwareUpdate (an SCCM related command). The ExpressionLanguage="Custom" doesn't mean anything to me. Is there a simple way that I can reference the sub properties displayed? Ultimately I'm trying to get the UpdateID.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Brian McMahon
  • 369
  • 3
  • 12

1 Answers1

6

I think you can parse this as XML?

See:

$xml = [xml]'<ApplicabilityRule ExpressionLanguage="Custom" Handler="{2DB70103-3DFB-4806-85B0-B27B561284BB}">
    <UpdateId>3a50171e-f09b-46fd-991c-ffa0c1fabcc6</UpdateId>
    <CISource>
        <Id>{7ABE2526-ED91-47AE-A989-275B4B2924FE}</Id>
        <Version>188</Version>
    </CISource>
    <ProductId>704a0a4a-518f-4d69-9e03-10ba44198bd5</ProductId>
</ApplicabilityRule>'

$xml.ChildNodes

Return:

ExpressionLanguage : Custom
Handler            : {2DB70103-3DFB-4806-85B0-B27B561284BB}
UpdateId           : 3a50171e-f09b-46fd-991c-ffa0c1fabcc6
CISource           : CISource
ProductId          : 704a0a4a-518f-4d69-9e03-10ba44198bd5
sodawillow
  • 12,497
  • 4
  • 34
  • 44
  • You are right, I needed to cast it and set a variable. I tried just casting it to [xml], but that didn't work out. Setting $xml = [xml]$match.ApplicabilityCondition does work as expected. – Brian McMahon Nov 28 '16 at 22:07