PowerCLI

 View Only
  • 1.  Custom DNS Suffixes

    Posted Aug 16, 2016 01:13 PM

    Hi All,

    How do I add a simple DNS suffix such as a wildcard "*.ldn" or even "ldn" to custom dns suffixes?

    I can add suffixes such as "mydomain.local" etc but not ldn on its own I have to manually add the search suffix for it to accept ldn

    set-vmhostnetwork $vmHostNetworkInfo -hostname $esxhostname -SearchDomain "mydomain.local","MYDOMAIN.LOCAL","ldn"

    is there a way to do this



  • 2.  RE: Custom DNS Suffixes

    Posted Aug 16, 2016 02:49 PM

    Did you try placing the string between single quotes?



  • 3.  RE: Custom DNS Suffixes

    Posted Aug 16, 2016 04:18 PM

    Yeah tried that, it doesn't like it either yet it doesn't complain when I enter direct via dcui



  • 4.  RE: Custom DNS Suffixes
    Best Answer

    Posted Aug 16, 2016 06:57 PM

    Did some further tests, and this is not allowed via the vSPhere CLient nor the Web Client either.

    That it works from the DCUI, seems to be because the API method doesn't seem to do any checking.

    In fact, this is accepted, but I'm not convinced it is a valid configuration, and if it will do what you assume it to do.

    $esxName = 'MyEsx'

    $esx = Get-VMHost -Name $esxName

    $netSys = Get-View -Id $esx.ExtensionData.ConfigManager.NetworkSystem

    $spec = New-Object VMware.Vim.HostDnsConfig

    $spec.SearchDomain = 'full.domain.com','*test'

    $spec.Dhcp = $esx.ExtensionData.Config.Network.DnsConfig.Dhcp

    $spec.DomainName = $esx.ExtensionData.Config.Network.DnsConfig.DomainName

    $spec.HostName = $esx.ExtensionData.Config.Network.DnsConfig.Hostname

    $netSys.UpdateDnsConfig($spec)



  • 5.  RE: Custom DNS Suffixes

    Posted Aug 17, 2016 08:56 AM

    Thanks once again LucD, evrything works I tested it this morning and it does append the "test" suffix and does resolve hostnames in that domain, without it it fails.

    Gracias