Created
May 10, 2013 14:49
-
-
Save jtuttas/5554881 to your computer and use it in GitHub Desktop.
Delete XML Node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rechnernetz subnet="255.255.255.0" > | |
<pc mac="23:cd:11:f1:2a:22"> | |
<ip>192.168.178.2</ip> | |
<name>Franks Desktop</name> | |
</pc> | |
<pc mac="23:cd:11:f1:2a:23"> | |
<ip>192.168.178.3</ip> | |
<name>Franks Notebook</name> | |
</pc> | |
<router mac="23:cd:11:f1:2a:24"> | |
<ip>192.168.178.1</ip> | |
<name>Fritzbox</name> | |
</router> | |
<nas mac="23:cd:11:f1:2a:33"> | |
<ip>192.168.178.5</ip> | |
<name>MP3 Server</name> | |
</nas> | |
<nas mac="23:cd:11:f1:2a:34"> | |
<ip>192.168.178.6</ip> | |
<name>Spielfilme</name> | |
</nas> | |
</rechnernetz> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
[xml]$a = Get-Content ("D:\Dropbox\temp\rechnernetz.xml") | |
$n = $a.SelectNodes("//pc") | |
foreach ($p in $n) { | |
if ($p.name -eq "Franks Notebook") { | |
$a.rechnernetz.RemoveChild($p) | |
} | |
} | |
$a.Save("D:\Dropbox\Temp\rechnernetz_neu.xml") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment