title: How can I parse XML from Get-GPOReport in Powershell?
body: <p>I'm trying to get a drive letter and mount location from an XML report generated from <code>Get-GPOReport</code> and place them inside a hash table.</p>
  <p>To get the XML I'm trying to pull information from I'm running</p>
  <pre><code>[xml]$gporeport = Get-GPOReport -name &quot;somegpo&quot; -ReportType xml
  </code></pre>
  <p>This turns up the following XML</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;
  &lt;GPO xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;http://www.microsoft.com/GroupPolicy/Settings&quot;&gt;
    &lt;Identifier&gt;
      &lt;Identifier xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;{466FD23F-3D4C-4908-859D-8A02EE9874B1}&lt;/Identifier&gt;
      &lt;Domain xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;example.com&lt;/Domain&gt;
    &lt;/Identifier&gt;
    &lt;Name&gt;GPO_Drive_Map&lt;/Name&gt;
    &lt;IncludeComments&gt;true&lt;/IncludeComments&gt;
    &lt;CreatedTime&gt;2019-03-15T18:51:30&lt;/CreatedTime&gt;
    &lt;ModifiedTime&gt;2019-06-26T20:30:42&lt;/ModifiedTime&gt;
    &lt;ReadTime&gt;2020-09-08T20:03:51.6746055Z&lt;/ReadTime&gt;
    &lt;SecurityDescriptor&gt;
      &lt;SDDL xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types/Security&quot;&gt;O:&lt;/SDDL&gt;
      &lt;Owner xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types/Security&quot;&gt;
        &lt;SID xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;&lt;/SID&gt;
        &lt;Name xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;example.com\Domain Admins&lt;/Name&gt;
      &lt;/Owner&gt;
      &lt;Group xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types/Security&quot;&gt;
        &lt;SID xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;&lt;/SID&gt;
        &lt;Name xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;example\Domain Admins&lt;/Name&gt;
      &lt;/Group&gt;
      &lt;PermissionsPresent xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types/Security&quot;&gt;true&lt;/PermissionsPresent&gt;
      &lt;Permissions xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types/Security&quot;&gt;
        &lt;InheritsFromParent&gt;false&lt;/InheritsFromParent&gt;
        &lt;TrusteePermissions&gt;
          &lt;Trustee&gt;
            &lt;SID xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;&lt;/SID&gt;
            &lt;Name xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;NT AUTHORITY\ENTERPRISE DOMAIN CONTROLLERS&lt;/Name&gt;
          &lt;/Trustee&gt;
          &lt;Type xsi:type=&quot;PermissionType&quot;&gt;
            &lt;PermissionType&gt;Allow&lt;/PermissionType&gt;
          &lt;/Type&gt;
          &lt;Inherited&gt;false&lt;/Inherited&gt;
          &lt;Applicability&gt;
            &lt;ToSelf&gt;true&lt;/ToSelf&gt;
            &lt;ToDescendantObjects&gt;false&lt;/ToDescendantObjects&gt;
            &lt;ToDescendantContainers&gt;true&lt;/ToDescendantContainers&gt;
            &lt;ToDirectDescendantsOnly&gt;false&lt;/ToDirectDescendantsOnly&gt;
          &lt;/Applicability&gt;
          &lt;Standard&gt;
            &lt;GPOGroupedAccessEnum&gt;Read&lt;/GPOGroupedAccessEnum&gt;
          &lt;/Standard&gt;
          &lt;AccessMask&gt;0&lt;/AccessMask&gt;
        &lt;/TrusteePermissions&gt;
        &lt;TrusteePermissions&gt;
          &lt;Trustee&gt;
            &lt;SID xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;&lt;/SID&gt;
            &lt;Name xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;NT AUTHORITY\SYSTEM&lt;/Name&gt;
          &lt;/Trustee&gt;
          &lt;Type xsi:type=&quot;PermissionType&quot;&gt;
            &lt;PermissionType&gt;Allow&lt;/PermissionType&gt;
          &lt;/Type&gt;
          &lt;Inherited&gt;false&lt;/Inherited&gt;
          &lt;Applicability&gt;
            &lt;ToSelf&gt;true&lt;/ToSelf&gt;
            &lt;ToDescendantObjects&gt;false&lt;/ToDescendantObjects&gt;
            &lt;ToDescendantContainers&gt;true&lt;/ToDescendantContainers&gt;
            &lt;ToDirectDescendantsOnly&gt;false&lt;/ToDirectDescendantsOnly&gt;
          &lt;/Applicability&gt;
          &lt;Standard&gt;
            &lt;GPOGroupedAccessEnum&gt;Edit, delete, modify security&lt;/GPOGroupedAccessEnum&gt;
          &lt;/Standard&gt;
          &lt;AccessMask&gt;0&lt;/AccessMask&gt;
        &lt;/TrusteePermissions&gt;
        &lt;TrusteePermissions&gt;
          &lt;Trustee&gt;
            &lt;SID xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;&lt;/SID&gt;
            &lt;Name xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;example.com\Domain Admins&lt;/Name&gt;
          &lt;/Trustee&gt;
          &lt;Type xsi:type=&quot;PermissionType&quot;&gt;
            &lt;PermissionType&gt;Allow&lt;/PermissionType&gt;
          &lt;/Type&gt;
          &lt;Inherited&gt;false&lt;/Inherited&gt;
          &lt;Applicability&gt;
            &lt;ToSelf&gt;true&lt;/ToSelf&gt;
            &lt;ToDescendantObjects&gt;false&lt;/ToDescendantObjects&gt;
            &lt;ToDescendantContainers&gt;true&lt;/ToDescendantContainers&gt;
            &lt;ToDirectDescendantsOnly&gt;false&lt;/ToDirectDescendantsOnly&gt;
          &lt;/Applicability&gt;
          &lt;Standard&gt;
            &lt;GPOGroupedAccessEnum&gt;Edit, delete, modify security&lt;/GPOGroupedAccessEnum&gt;
          &lt;/Standard&gt;
          &lt;AccessMask&gt;0&lt;/AccessMask&gt;
        &lt;/TrusteePermissions&gt;
        &lt;TrusteePermissions&gt;
          &lt;Trustee&gt;
            &lt;SID xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;&lt;/SID&gt;
            &lt;Name xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;NT AUTHORITY\Authenticated Users&lt;/Name&gt;
          &lt;/Trustee&gt;
          &lt;Type xsi:type=&quot;PermissionType&quot;&gt;
            &lt;PermissionType&gt;Allow&lt;/PermissionType&gt;
          &lt;/Type&gt;
          &lt;Inherited&gt;false&lt;/Inherited&gt;
          &lt;Applicability&gt;
            &lt;ToSelf&gt;true&lt;/ToSelf&gt;
            &lt;ToDescendantObjects&gt;false&lt;/ToDescendantObjects&gt;
            &lt;ToDescendantContainers&gt;true&lt;/ToDescendantContainers&gt;
            &lt;ToDirectDescendantsOnly&gt;false&lt;/ToDirectDescendantsOnly&gt;
          &lt;/Applicability&gt;
          &lt;Standard&gt;
            &lt;GPOGroupedAccessEnum&gt;Apply Group Policy&lt;/GPOGroupedAccessEnum&gt;
          &lt;/Standard&gt;
          &lt;AccessMask&gt;0&lt;/AccessMask&gt;
        &lt;/TrusteePermissions&gt;
        &lt;TrusteePermissions&gt;
          &lt;Trustee&gt;
            &lt;SID xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;&lt;/SID&gt;
            &lt;Name xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;example.com\group&lt;/Name&gt;
          &lt;/Trustee&gt;
          &lt;Type xsi:type=&quot;PermissionType&quot;&gt;
            &lt;PermissionType&gt;Allow&lt;/PermissionType&gt;
          &lt;/Type&gt;
          &lt;Inherited&gt;false&lt;/Inherited&gt;
          &lt;Applicability&gt;
            &lt;ToSelf&gt;true&lt;/ToSelf&gt;
            &lt;ToDescendantObjects&gt;false&lt;/ToDescendantObjects&gt;
            &lt;ToDescendantContainers&gt;true&lt;/ToDescendantContainers&gt;
            &lt;ToDirectDescendantsOnly&gt;false&lt;/ToDirectDescendantsOnly&gt;
          &lt;/Applicability&gt;
          &lt;Standard&gt;
            &lt;GPOGroupedAccessEnum&gt;Edit Settings&lt;/GPOGroupedAccessEnum&gt;
          &lt;/Standard&gt;
          &lt;AccessMask&gt;0&lt;/AccessMask&gt;
        &lt;/TrusteePermissions&gt;
        &lt;TrusteePermissions&gt;
          &lt;Trustee&gt;
            &lt;SID xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;&lt;/SID&gt;
            &lt;Name xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types&quot;&gt;example.com\Enterprise Admins&lt;/Name&gt;
          &lt;/Trustee&gt;
          &lt;Type xsi:type=&quot;PermissionType&quot;&gt;
            &lt;PermissionType&gt;Allow&lt;/PermissionType&gt;
          &lt;/Type&gt;
          &lt;Inherited&gt;false&lt;/Inherited&gt;
          &lt;Applicability&gt;
            &lt;ToSelf&gt;true&lt;/ToSelf&gt;
            &lt;ToDescendantObjects&gt;false&lt;/ToDescendantObjects&gt;
            &lt;ToDescendantContainers&gt;true&lt;/ToDescendantContainers&gt;
            &lt;ToDirectDescendantsOnly&gt;false&lt;/ToDirectDescendantsOnly&gt;
          &lt;/Applicability&gt;
          &lt;Standard&gt;
            &lt;GPOGroupedAccessEnum&gt;Edit, delete, modify security&lt;/GPOGroupedAccessEnum&gt;
          &lt;/Standard&gt;
          &lt;AccessMask&gt;0&lt;/AccessMask&gt;
        &lt;/TrusteePermissions&gt;
      &lt;/Permissions&gt;
      &lt;AuditingPresent xmlns=&quot;http://www.microsoft.com/GroupPolicy/Types/Security&quot;&gt;false&lt;/AuditingPresent&gt;
    &lt;/SecurityDescriptor&gt;
    &lt;FilterDataAvailable&gt;true&lt;/FilterDataAvailable&gt;
    &lt;Computer&gt;
      &lt;VersionDirectory&gt;2&lt;/VersionDirectory&gt;
      &lt;VersionSysvol&gt;2&lt;/VersionSysvol&gt;
      &lt;Enabled&gt;true&lt;/Enabled&gt;
    &lt;/Computer&gt;
    &lt;User&gt;
      &lt;VersionDirectory&gt;20&lt;/VersionDirectory&gt;
      &lt;VersionSysvol&gt;20&lt;/VersionSysvol&gt;
      &lt;Enabled&gt;true&lt;/Enabled&gt;
      &lt;ExtensionData&gt;
        &lt;Extension xmlns:q1=&quot;http://www.microsoft.com/GroupPolicy/Settings/DriveMaps&quot; xsi:type=&quot;q1:DriveMapSettings&quot;&gt;
          &lt;q1:DriveMapSettings clsid=&quot;{Some-SID}&quot;&gt;
            &lt;q1:Drive clsid=&quot;{another_sid}&quot; name=&quot;F:&quot; status=&quot;F:&quot; image=&quot;2&quot; changed=&quot;2019-03-15 19:08:41&quot; uid=&quot;{anothersid}&quot; bypassErrors=&quot;1&quot;&gt;
              &lt;q1:GPOSettingOrder&gt;1&lt;/q1:GPOSettingOrder&gt;
              &lt;q1:Properties action=&quot;U&quot; thisDrive=&quot;NOCHANGE&quot; allDrives=&quot;NOCHANGE&quot; userName=&quot;&quot; path=&quot;\\fs.example.com\data&quot; label=&quot;LABEL&quot; persistent=&quot;1&quot; useLetter=&quot;1&quot; letter=&quot;F&quot; /&gt;
              &lt;q1:Filters /&gt;
            &lt;/q1:Drive&gt;
            &lt;q1:Drive clsid=&quot;{another_sid}&quot; name=&quot;V:&quot; status=&quot;V:&quot; image=&quot;2&quot; changed=&quot;2019-03-15 19:10:08&quot; uid=&quot;{another_sid}&quot;&gt;
              &lt;q1:GPOSettingOrder&gt;2&lt;/q1:GPOSettingOrder&gt;
              &lt;q1:Properties action=&quot;U&quot; thisDrive=&quot;NOCHANGE&quot; allDrives=&quot;NOCHANGE&quot; userName=&quot;&quot; path=&quot;\\fs.example.com\users\%username%&quot; label=&quot;example.com\%username%&quot; persistent=&quot;1&quot; useLetter=&quot;1&quot; letter=&quot;V&quot; /&gt;
              &lt;q1:Filters /&gt;
            &lt;/q1:Drive&gt;
          &lt;/q1:DriveMapSettings&gt;
        &lt;/Extension&gt;
        &lt;Name&gt;Drive Maps&lt;/Name&gt;
      &lt;/ExtensionData&gt;
    &lt;/User&gt;
    &lt;LinksTo&gt;
      &lt;SOMName&gt;Name&lt;/SOMName&gt;
      &lt;SOMPath&gt;example.com/Level1/Level2&lt;/SOMPath&gt;
      &lt;Enabled&gt;true&lt;/Enabled&gt;
      &lt;NoOverride&gt;false&lt;/NoOverride&gt;
    &lt;/LinksTo&gt;
  &lt;/GPO&gt;
  </code></pre>
  <p>I was trying to get the info using <code>$gporeport.GPO.User.ExtensionData.Extension.ChildNodes</code> but I couldn't figure out how to get down to the drives section and get the drive letter and mount location.</p>