PowerCLI

 View Only
  • 1.  List of DNS server assigned to VM

    Posted Jul 19, 2022 12:36 PM

    Hi gurus.

     

    I am looking for a script the bring me the information of the DNS server/IP that a VM has 

    Get-vm | select name , Here is where I am having trouble getting the DNSserver for the vm

     

    Thanks 



  • 2.  RE: List of DNS server assigned to VM
    Best Answer

    Posted Jul 19, 2022 01:02 PM

    That info is coming from the Guest OS, so it is not available for all operating systems.
    For most Windows OS, and provided VMware Tools are running, you can do

    Get-VM |
    Select-Object Name, @{N = 'DNSServers'; E = { $_.ExtensionData.Guest.Net.dnsconfig.ipaddress -join '|'}}
    


    To have this info for types of Guest OS, you could consider running a Guest OS native script

     



  • 3.  RE: List of DNS server assigned to VM

    Posted Jul 20, 2022 03:32 PM

    LucD

     

    worked like a charm , thanks a bunch