find a string in a lot of different xml nodes

i have a scom custom management pack. i have the xml loaded as $xml. the text “Microsoft.Windows.Server.2003” appears in the xml around 100 times. it can appear as “id”, it can appear as “context,” it can appear in “target”. the node names are all different. here’s a sample:

i want to find all nodes that contain the text “Microsoft.Windows.Server.2003” in any way, shape, form, property, attribute, etc. is that doable? i’ve seen some promising stuff about select-xml, but all the examples seem to be about xml nodes that are identical.

Never tried this, but below example and link might help you which uses SCOM cmdlets.

$MPFile = "<path>\"
Get-SCOMMonitor -ManagementPack $MPFile

thank you, but no, i need the actual xml nodes so i can then delete them from the xml file. so far i’m doing this, but i’m hoping there’s a more efficient way to just locate every node that contains $mp, in case i run into some xml where i don’t know the exact path and property of every node.

<script src=“”></script>