Search code examples
powershellserializationsccm

Two different ways to deserialize SDMPackageXML


Writing a script to extract from all the applications, the ones that do not match the standards, I had to deserialize SDMPackageXML. At first, I thought I had found two ways of doing so. After digging, it "seems" to me I gained access to two different sets of information. And I do not understand why each method does not give access to the same information.

Here is the code used :

$app=gwmi -computer servername -namespace root\sms\site_code -class sms_application -filter "LocalizedDisplayName='AppName'"
$app.get()
([Microsoft.ConfigurationManagement.ApplicationManagement.Serialization.SccmSerializer]::DeserializeFromString($app.SDMPackageXML)).AutoInstall
([xml]($app.SDMPackageXML)).AppMgmtDigest.DeploymentType.Installer.RequiresLogon

I can not access AutoInstall property with both method.

I can not access RequiresLogon property with both method.

I am clearly missing something. Could someone point out what?


Solution

  • My bad, the two sets of information are identical, accessing them is just different.

    For instance, ([Microsoft.ConfigurationManagement.ApplicationManagement.Serialization.SccmSerializer]::Deserialize FromString($app.SDMPackageXML)).DeploymentTypes[0].Installer

    and

    ([xml]($app.SDMPackageXML)).AppMgmtDigest.DeploymentType.Installer.RequiresLogon

    will give the same result.

    At first, I did not identify it for I thought, values without braces did not contain more properties.