Hello,
First, allow me to explain that I am a newb to PoSH, .NET, and
processing XML altogether, so apologise in advance for such basic
questions. I'm coming straight from VB6/VBScript to all of this
wonderful new stuff, and it's all a bit overwhelming.
In any event, hoping that someone can assist. I took a copy of
Microsoft's CreateXMLFromEnvironment.wsf from the Group Policy
Management Console, modified it slightly such that it outputs Group
Policy GUIDs, and am looking for a way to create a PS1 to query all of
the unique GUIDs contained therein. The XML structure looks something
like this:
<DomainRoot>
<OU Name="OUName1">
<OU Name="OU2">
<GPOLink GPOName="Policy1" GUID="abcdefg1">
<OU Name="OU3">
<GPOLink GPOName="Policy2" GUID="abcdefg2">
</OU>
</OU>
</OU>
</DomainRoot>
So, in other words, the GPOLink attribute can exist anywhere in the
tree, and it might or might not be present.
I've been trying things like get-childitem such that I might create a
recursive function, but so far that hasn't gotten my anywhere. Also
tried... think it was maybe sort-object -unique? Can't remember off
hand. Anyway, that got me nowhere either. Tried enumerating child
objects using the XML .get_firstchild and others, and got stuck on
those too. If I could write this in SQL, could figure it out, but this
syntax is killing me. And how do you get help on the methods defined
in the System.Xml.XmlLinkedNode objects?
Hoping that someone can give me a clue.
Thanks,
Shawn.


