DNS Suffix in windows does not change when switching between different networks RRS feed

  • Question

  • I writing a command line script in Windows8, I need to detect whenever a DNS suffix change( search domain) when we move from one network to another. i am using following command to detect DNS suffix changes:</b>

    wmic nicconfig get DNSDomainSuffixSearchOrder /ALL /EVERY:5 /REPEAT:10

    The output is DNSDomainSuffixSearchOrder {"my.dns.suffix.local"} {"my.dns.suffix.local"} while this command is running i am switching between different networks but that does not change anything is the output for this command. both the networks i am switching between, has DHCP ,with DNS suffix config, which is being received in OSx and updated timely in OSx scipt but in windows update is not happening. Is there any file, which i can read these values from, if not being updated in the command properly?

    Note:I have verified in OSx the saerch domains(dns suffixes) are being updated nicely.

    I am expecting that the DNS Suffixes should be updated wheneveri switch between different networks if they have DHCP with DNS suffix config.

    Monday, May 13, 2019 11:15 AM

All replies

  • You command is not a script it just a system utility.

    The issue can be posted in the Windows networking forum. 

    The SearchOrder is not changed by changing networks.  It is set by configuration.  Check with your network techs to find out how your network is configured for Windows systems.


    Monday, May 13, 2019 3:00 PM
  • Try using the powershell commandlet

    Get-WmiObject win32_networkadapterconfiguration

    instead of the old wmic.exe

    That returns structured information that's easier to parse in the following script using regular Powershell commands like "where"

    Thursday, May 16, 2019 1:41 PM