Richard Siddaway's Blog

Started to investigate the DnsClient module.  First cmdlet to catch my eye was Get-DnsClientServerAddress.

Always good to know a way to find the DNS server.

Now thats OK but I’d like a bit more information – especially the adapter and IP version.  We can get that data using Get-NetAdapter from the NetAdapter module.

Get-DnsClientServerAddress|where{$_.ServerAddresses-and$_.InterfaceAlias-notlike"Loop*"}|foreach{$nic=$_Get-NetAdapter-IncludeHidden-InterfaceIndex$($nic.InterfaceIndex)|Add-Member-MemberTypeNoteProperty-NameServerAddresses-Value$($nic.ServerAddresses)-PassThru|Add-Member-MemberTypeNoteProperty-NameAddressFamily-Value$(if($nic.AddressFamily-eq2){"IPv4"}else{"IPv6"})-PassThru|selectName,InterfaceDescription,ifIndex,Status,MacAddress,LinkSpeed,AddressFamily,ServerAddresses}

 

I restricted the output to those interfaces that had DNS server addresses…

View original post 42 altre parole