A PowerShell DNS Suffix Tool

The other day my good friend Greg Shields asked for a little assistance with a PowerShell problem. He was trying to use PowerShell to set the primary DNS suffix for a computer. This  is different than the DNS suffix you can set on a network adapter configuration. Instead, he was looking at the dialog box you get when you set the computer name under advanced properties from the control panel System settings.

system1

We couldn’t find any cmdlet that would modify this setting. Eventually Greg discovered that you need to set both the Domain and NV Domain settings under

HKLM:\system\CurrentControlSet\Services\tcpip\parameters. Now that, was something I could work with.

Within short order I had a simple module, DNSSuffix, with commands to get the domain settings and set them.  The functions use PowerShell remoting so that you can manage remote computers. You can check out the documentation and code in Github (https://github.com/jdhitsolutions/DNSSuffix) or install the module from the PowerShell Gallery: Install-Module DNSSuffix.

 

If you run into issues or have suggestions, please use the Issues section of the GitHub repository.

Leave a Reply

Your email address will not be published. Required fields are marked *