This topic contains 3 replies, has 2 voices, and was last updated by
May 11, 2015 at 4:38 am #25081
I have navigated my first XML Powershell experience recently with no problem. It features a no namespace xml file and I have mastered xpath to get me anywhere I wish.
Today I ran get-gporeport to produce an xml file with every gpo. I thought I could do my selectnodes and select-xmls with ease. Sadly nothing happened. Google told me about namespaces.
It said, If you dont define namespaces, you cannot read a thing, you cannot dance the xml element search and retrieve.
What's worse, google has next to nothing about bulletproof "just run this boilerplate code and then you can do selectnodes etc without a problem".
So either I run through the text of my huge gpo xml file and pull out all this xmlns garbage or define some namespace object that will allow me to xpath with ease.
Has anyone got any decent reference or best practice, particularly with reference to the xml produced by get-gporeport?
I tried the code at http://outputredirection.blogspot.com.au/2010/01/using-powershell-to-search-for-group.html and it didnt work.
May 11, 2015 at 5:08 am #25082ParticipantPoints: 527Rank: Major Contributor
A quick search and I found this:
Depending on what data you are looking for, Get-GPO will show you information in a standard Powershell format: See these methods as well:
May 11, 2015 at 12:31 pm #25106
Thanks – I saw those. None of those still have the magic code to unlock xml searching by creating the necessary namespaces. The first post I mentioned does, but it doesnt work when I try it.
May 12, 2015 at 3:13 am #25121
The topic ‘XML and namespaces’ is closed to new replies.