working on a script to backup DNS settings from a NIC and changing them back after some other actions.
$BACKUP = Get-DnsClientServerAddress -InterfaceAlias WLAN* >>c:tmpdns.txt
contents of dns.txt
InterfaceAlias Interface Address ServerAddresses
Index Family
-------------- --------- ------- ---------------
WLAN 2 6 IPv4 {1.1.1.1, 8.8.8.8}
WLAN 2 6 IPv6 {}
now for restoring i just need the 2 IP’s between the {} so im starting with
$OLD = Get-Content C:tmpdns.txt | Select-String -Pattern 'ipv4' -SimpleMatch
what leaves me with
WLAN 2 6 IPv4 {1.1.1.1, 8.8.8.8}
but how do i get rid of the rest to get just the 2 IP’s left in $Old
thx for help