How can i remove the innertext from an xml object via powershell.
cosider:
<XML>
<AddServer>win-coll3.astest.org</AddServer>
<SERVERS>
<Server load="119" url="win-coll.astest.org"/>
<Server load="119" url="win-coll2.astest.org"/>
</SERVERS>
</XML>
I Want to clear out the AddServer
section
i tried: $FileAsXMLObject.xml.Remove("AddServer")
but didnt work
I dont want to delete the section - just cleared out. somesthing like this:
<XML>
<AddServer> </AddServer>
<SERVERS>
<Server load="119" url="win-coll.astest.org"/>
<Server load="119" url="win-coll2.astest.org"/>
</SERVERS>
</XML>
You just need to clear the value of that element. This will work:
$FileAsXMLObject.xml.AddServer = [string]::Empty
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.