I have a PowerShell script that is writing to the machine.config file, it has a section written into it that I want to remove:
<system.net> <connectionManagement> <add address = "*" maxconnection = "$(200 * $numberOfCores)" /> </connectionManagement> </system.net> This is what the entire file looks like:
<configuration> <system.data> <DbProviderFactories /> </system.data> <system.net> <connectionManagement> <add address = "*" maxconnection = "$(200 * $numberOfCores)" /> </connectionManagement> </system.net> </configuration> I want to remove the entire <system.net> section, but I cant figure out how to remove this section. I can remove the children, but I want the section gone, can someone please help me remove it?
For example, I can use
$node.RemoveChild(($node.SelectSingleNode("connectionManagement"))) | Out-Null to remove <connectionManagement> inside of <system.net> but how do I remove that entire section/node, whatever it is called?
I want my final XML file to be
<configuration> <system.data> <DbProviderFactories /> </system.data> </configuration> How can I delete the <system.net> section?
No comments:
Post a Comment