Forum Discussion
SteveCox
Feb 08, 2022Brass Contributor
new content after last match of a Pattern in XML file
Hi I am trying to use Powershell to add content to an XML file after the last match of a pattern I need to add the content from $OutTemp txt file "<!-- steve.cox - test3 -02/02/2022 11:01:36 --> ...
- Feb 12, 2022Glad it help.
Kindly mark the answer as best response.
For the XML, I need to check it, and also you can start a new post as it also be better in the search engines.
Thanks
farismalaeb
Feb 10, 2022Steel Contributor
Did this one work?
- SteveCoxFeb 10, 2022Brass ContributorHi yes thanks for the help worked perfectly, still had an issue with the Encoding of the XML output being Created as UTF-16 LE BOM so wouldn't Parse correctly so fixed this with this line to save a UTF-8 "[IO.File]::WriteAllLines($XMLPath, $BOMFile)" and also found that Defender doesn't Like Comments in the "Descriptor ID" so have removed them and created change log in a different Location So if anyone is trying to Use Scripts to Edit the XML Files for Defender USB Blocking watch out for Encoding and Comments Thanks again for the assistance
- farismalaebFeb 12, 2022Steel ContributorGlad it help.
Kindly mark the answer as best response.
For the XML, I need to check it, and also you can start a new post as it also be better in the search engines.
Thanks