Find all unique values within XML file and write output to file.
Select-Xml -path "Sample.xml" -xpath "/descendant::Lastname/text()" | foreach-object {$_.Node.Value} | sort | get-unique | out-file "out.txt"
Use it with XML namespaces
Select-Xml -path "Sample.xml" -xpath "/descendant::ns:StyleColorStatus/text()" -Namespace @{ns="http://SampleNamespace"} | foreach-object {$_.Node.Value} | sort | get-unique | out-file "c:\temp\out.txt"
Use it with XML namespaces
Select-Xml -path "Sample.xml" -xpath "/descendant::ns:StyleColorStatus/text()" -Namespace @{ns="http://SampleNamespace"} | foreach-object {$_.Node.Value} | sort | get-unique | out-file "c:\temp\out.txt"