Reputation: 715
I have a XML-file (exported GPO) that I want to filter to retrieve a certain string. This string contains the GUID of the GPO. Header of my XML-file which contains the GUID:
<Identifier>
<Identifier xmlns="http://www.microsoft.com/GroupPolicy/Types">{81BB9R5B-BC1E-433C-A62T-06DC8A62AAF1}</Identifier>
<Domain xmlns="http://www.microsoft.com/GroupPolicy/Types">domain.com</Domain> </Identifier>
How can I use Powershell to filter out the GUID: "{81BB9R5B-BC1E-433C-A62T-06DC8A62AAF1}" ?
Any help would be greatly appreciated
Upvotes: 0
Views: 189
Reputation: 52609
One way using the way PowerShell creates note properties on XmlDocument objects:
$xml = [xml] @'
<Identifier>
<Identifier xmlns="http://www.microsoft.com/GroupPolicy/Types">{81BB9R5B-BC1E-433C-A62T-06DC8A62AAF1}</Identifier>
<Domain xmlns="http://www.microsoft.com/GroupPolicy/Types">domain.com</Domain>
</Identifier>
'@
$xml.Identifier.Identifier."#text"
Upvotes: 1