Page 2 of 2
Re: Get DNS records
Posted: Tue Mar 05, 2019 4:34 pm
by apowershelluser
So going back
(Get-WmiObject Win32_NetworkAdapterConfiguration -FIlter 'IPEnabled=True').DNSDomainSuffixSearchOrder
Only one of my adapters had an IP
It still returned duplicates
I just want all of my 20+ DNSs in a variable to use
Re: Get DNS records
Posted: Tue Mar 05, 2019 6:15 pm
by jvierra
If you do this:
Get-WmiObject Win32_NetworkAdapterConfiguration -FIlter 'IPEnabled=True'
What do you see?
Re: Get DNS records
Posted: Tue Mar 05, 2019 9:16 pm
by apowershelluser
- DNS2.png (27.05 KiB) Viewed 2666 times
Re: Get DNS records
Posted: Wed Mar 06, 2019 1:07 am
by jvierra
What does this show:
Get-WmiObject Win32_NetworkAdapterConfiguration -FIlter 'IPEnabled=True'| select name,DNSDomainSuffixSearchOrder
Re: Get DNS records
Posted: Wed Mar 06, 2019 7:38 am
by apowershelluser
I did forget to add, it showed one under DNSDomain
This appears duplicates
- Snag_5c52f2.png (12.7 KiB) Viewed 2628 times
Re: Get DNS records
Posted: Wed Mar 06, 2019 8:12 am
by jvierra
You are returning two adapters. That will give you duplicates. You can only expand arrays on one adapter to get only that adapters settings.
Re: Get DNS records
Posted: Wed Mar 06, 2019 10:41 am
by apowershelluser
This finally gives me one
Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {($_.IPEnabled -eq $true) -and ($_.DHCPEnabled -eq $true)} | select name,DNSDomainSuffixSearchOrder
There is also a VM adapter enabled, BUT it doesn't have any DNSDomains attached to it..
Regardless, I'm picking up what you're putting down.