Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xDnsServerAddress does not allow clearing of primary/secondary DNS Address #211

Open
andy1547 opened this issue May 17, 2017 · 11 comments
Open
Assignees
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.

Comments

@andy1547
Copy link

Address has a ValidateNotNullOrEmpty attribute however it's a valid operation to clear it.
If using DHCP then the manual address would be set back to automatic (just like the GUI).
If using a static IP, then the manual addresses would be cleared.

@andy1547
Copy link
Author

andy1547 commented May 26, 2017

When empty it should use the following cmdlet Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ResetServerAddresses
This mimics the Windows UI functionality in that if DHCP is enabled DNS is set to automatic, if static IP is enabled the DNS is set to blank manual address (windows still technically classes this as automatic).

@PlagueHO PlagueHO added discussion The issue is a discussion. enhancement The issue is an enhancement request. labels May 29, 2017
@PlagueHO
Copy link
Member

Hi @andy1547 - thanks for raising this!

I have battled with this problem for a while now and I've tried to sum up the problem in this issue:
#113

I think it actually requires a change to the PowerShell cmdlets to expose whether or not DHCP is enabled on the DNS Client itself - which is currently not visible at all the PowerShell.

@PlagueHO PlagueHO added in progress The issue is being actively worked on by someone. and removed discussion The issue is a discussion. labels Jun 3, 2017
@PlagueHO
Copy link
Member

PlagueHO commented Jun 3, 2017

Hi @andy1547 - I've completed the changes for this and am just waiting for a review to merge into the Dev branch. But if you're up for it you could test my version here:
https://github.com/PlagueHO/xNetworking/tree/Issue-113

Thanks!

@PlagueHO PlagueHO self-assigned this Jun 4, 2017
@andy1547
Copy link
Author

@PlagueHO
Having a skim over this it looks great so far, will hopefully get a chance to test some week sometime (deadlines are pretty tight over here).
Thanks!

@PlagueHO
Copy link
Member

Thanks @andy1547 - this change has now been merged into Dev. So you can try it on the dev branch now.

@andy1547
Copy link
Author

Will test this week, thanks @PlagueHO

@PlagueHO PlagueHO added waiting for author response The pull request is waiting for the author to respond to comments in the pull request. and removed in progress The issue is being actively worked on by someone. labels Jun 24, 2017
@PlagueHO
Copy link
Member

Hi @andy1547 - did you get a chance to check this one? Did it work OK? If so, can we close this one?

@andy1547
Copy link
Author

andy1547 commented Jul 30, 2017

Sorry @PlagueHO been a busy free months!

Managed to test this today and worked as expected.
Tested the standard use cases and the following edge cases with IPv4:

  • 3+ dns servers.
  • clearing the DNS servers both with DHCP enabled and disabled.

The only thing thing I noticed is an empty array is not permitted to clear the DNS servers, ideally an empty array would clear but null would leave as is.

Great work though, thanks!

@PlagueHO
Copy link
Member

PlagueHO commented Nov 4, 2017

Hi @andy1547 - sorry I forgot to respond to this one. But actually, it does look like we should be able to accept an empty array for Address. If you don't specify an Address parameter at all, internally it sets $Address to an empty array anyway. So I'll hold this open so we can consider making this enhancement.
Thanks!

@johlju johlju added help wanted The issue is up for grabs for anyone in the community. and removed waiting for author response The pull request is waiting for the author to respond to comments in the pull request. labels Aug 21, 2018
@spali
Copy link

spali commented Feb 13, 2019

If anyone else has the same problem to detect if the dns servers are static or from dhcp:
netsh interface ipv4 show dns
netsh interface ipv6 show dns
there is no known other ("better") api, event wmi documentation does not state anything.

@phbits
Copy link
Contributor

phbits commented Mar 24, 2021

When empty it should use the following cmdlet Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ResetServerAddresses
This mimics the Windows UI functionality in that if DHCP is enabled DNS is set to automatic, if static IP is enabled the DNS is set to blank manual address (windows still technically classes this as automatic).

This functionality is available in DnsServerAddress.

@PlagueHO - I believe this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants