I am executing the following command:
gwmi win32_networkadapterconfiguration|where {$_.IPAddress}|select dnsserversearchorder
On screen this comand returns the DNS Servers for IP enabled NIC in the following format:
{192.1.1.1, 192.1.1.2}
When I use export-csv the value listed in the column is System.String[]
2 things:
- How do I convert this value to a value that will output like what I see on the command line?
- How do I "Split" this value so that I can output each value into a DNS1 and DNS2 variable?
I have tried this unsuccessfully:
$dnsso = gwmi win32_networkadapterconfiguration|where {$_.IPAddress}|select dnsserversearchorder
echo $dnnso[0].Split(",")
It complain that Split is not a valid function of the type it is passed.
Thanks,
-MattG