Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Problem with Select-XML in Powershell

Posted on 2013-10-26
Medium Priority
Last Modified: 2013-11-24

I am having trouble trying to select some XML notes under
in an xml file.

Basically I want to set a variable to be all the
MSI application objects.

I would like to be able select all of them into an array.

I am trying the following statement and it does not seem to work.

It seems my xpath might be wrong?

I have attached the XML file.

Any suggestions?


$xpath = "/GPO/Computer/ExtensionData"
[xml]$a = Get-Content .\ComputerExample.xml
$b = $a | Select-Xml -XPath $xpath

Open in new window

Question by:whorsfall
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 44

Accepted Solution

Rainer Jeschor earned 2000 total points
ID: 39604145
Hi Ward,

you might also be able to directly use this:
$b = $a.GPO.Computer.ExtensionData.Extension.MsiApplication

Open in new window

This should return all MsiApplication nodes.


Author Comment

ID: 39605328

Thanks for your response. Do u know why the Xpath search failed?



Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question