DNS servers in report - system string instead

Hello

Once more I'm stuck, I'm trying to get the dns server info out and in the sub report, all other parts work but when I run the script I get the following in the column for DNS servers.

System.String]

If I just run the script by pasting in the VI Toolbox displays the following:

{192.168.2.1, 192.168.2.2}

That's what I would when converting to HTML.

I have two DNS servers, that's why and if it means that I got several entries for the other parties they also would not work.

Could someone point me in the right direction?

Thanks again,

Dan

$Report = @)

$ESXHosts = get-VMHost | Sort name | Get-View

ForEach ($ESXHost to $ESXHosts)

{

$ReportObj = "" | Select the name, 'Blocked incoming firewall', 'Blocked outgoing firewall', 'DNS servers", 'VMk Def Gateway', 'SC Def Gateway'

$ReportObj.Name = $ESXHost.Name

$ReportObj. "" Firewall incoming blocked "= $ESXHost.config.firewall.defaultPolicy.incomingBlocked

$ReportObj. "" Firewall outgoing blocked "= $ESXHost.config.firewall.defaultPolicy.outgoingBlocked

$ReportObj. "" DNS servers "= $ESXHost.config.network.dnsconfig.address

$ReportObj. "" VMk Def Gateway ' = $ESXHost.config.Network.IpRouteConfig.DefaultGateway

$ReportObj. "' SC Def Gateway ' = $ESXHost.config.Network.ConsoleIpRouteConfig.DefaultGateway

$Report += $ReportObj

}

$Report | ConvertTo-Html-title "Firewall host, DNS and default gateways" - body "& lt; H4 & gt; Host firewalls, DNS and gateway by default & lt; / H4 & gt; » | Out-file - add $filelocation

Try this.

$ReportObj. "" DNS1 "= $ESXHost.config.network.dnsconfig.address [0]

$ReportObj. "' DNS2 ' = $ESXHost.config.network.dnsconfig.address [1]

Post edited by: Zsoldier

Tags: VMware

Similar Questions

  • Why do I get System.String [] when I export to CSV format instead of the data that I'm looing?

    I HAV a real simple script that pulls information about DNS configuration & my ESXi hosts routing settings. version of ESXi 4.1 is

    Get-VMHost | Get-VMHostNetwork | Select VMHost, VMKernelGateway, DnsAddress, DnsFromDhcp, hostname, domain name SearchDomain

    When I use the above script I get the result on the screen I want to see:

    $vmhost: MyHostDisplayName1

    VMKernelGateway: 10.10.10.10

    DnsAddress: {10.10.10.11, 10.10.10.12}

    DnsFromDhcp: false

    HostName: MyHostName1

    Domain name: MyDomainName.local

    SearchDomain: {MyDomainName.local}

    When I try to channel this output in CSV format, I find myself with a problem:

    Get-VMHost | Get-VMHostNetwork | Select VMHost, VMKernelGateway, DnsAddress, DnsFromDhcp, hostname, domain name SearchDomain | Export-Csv C:\VMHostDNSinfo.csv

    My CSV does not show the SearchDomain or the DnsAddress. How to replace the [System.Stinr] with a correct output?

    VMHost

    VMKernelGateway

    DnsAddress

    DnsFromDhcp

    Host name

    Domain name

    SearchDomain

    MyHostDisplayName1

    10.10.10.10

    System.String]

    FAKE

    MyHostName1

    MyDomainName.local

    System.String]

    MyHostDisplayName2

    10.10.10.9

    System.String]

    FAKE

    MyHostName2

    MyDomainName.local

    System.String]

    MyHostDisplayName3

    10.10.10.8

    System.String]

    FAKE

    MyHostName3

    MyDomainName.local

    System.String]

    You must convert arrays to strings before exporting them one. CSV file. You can do this with the following script:

    Get-VMHost | Get-VMHostNetwork | `
    Select-Object VMHost, VMKernelGateway,
      @{N="DnsAddress";E={[string]::Join(",",$_.DnsAddress)}},
      DnsFromDhcp, HostName, DomainName,
      @{N="SearchDomain";E={[string]::Join(",",$_.SearchDomain)}} | `
    Export-Csv -Path VMHostDNSinfo.csv -NoTypeInformation -UseCulture
    

    Best regards, Robert

  • PowerCLI Script to change the DNS servers and domain name

    Hello

    Brand new to PowerCLI, I'm trying to create a script that will change the domain name and the DNS servers of my ESXi servers. I found that I need to update the Vmware.Vim.HostDnsConfig to update these settings. I created the following script and the following error.

    $config = new-Object VMware.Vim.HostDnsConfig
    $config.domainName = "new.domain.com".
    $config.address = new-Object System.String [] (2)
    $config.address [0] = "10.69.69.80".
    $config.address [1] = "10.69.70.80".

    _this $ = get-view-Id "HostNetworkSystem-networkSystem.

    _this $. UpdateDnsConfig ($config)

    You can not call a method on a null value expression.

    Line: 1 char: 23

    + $_C. UpdateDnsConfig < < < < ($config)

    + CategoryInfo: InvalidOperation: (UpdateDnsConfig:String)], RuntimeException

    + FullyQualifiedErrorId: InvokeMethodOnNull

    I guessed the error message that I need to a value in the host name, I do not need to change the host name. So I create a variable to remove the host name and place it in the $config. Line received host name but still a mistake because the variable is pulling more information that I need.

    $hostname = get-VMHost | Select name

    $config. Hostname = $hostname

    When I insert the above code I have an error.

    Exception by calling 'UpdateDnsConfig' with '1' or the arguments: ' year error occurred during the configuration of the host.
    Line: 1 char: 23
    + $_C. UpdateDnsConfig < < < < ($config)
    + CategoryInfo: NotSpecified: (:)) [], MethodInvocationException)
    + FullyQualifiedErrorId: DotNetMethodException

    When I look at the $config I see the following.

    DHCP: false
    VirtualNicDevice:
    HostName: @{Name = ESXI01}
    Domain name: new.domain.com
    Address: {10.69.69.80, 10.69.70.80}
    SearchDomain:
    DynamicType:
    DynamicProperty:

    Of course the @{Name = ESXI01} will not work. Someone can explain how to get a host name in a variable and pass it to the Config.Hostname?

    You should be able to do easily by using the command "set-vmhostnetwork.

    I don't think that you can just write to VMWare.Vim.HostDnsConfig.

  • Why is-36 of Firefox on Windows receiving connections from DNS servers? Option network.dns.get - ttl

    Following update Firefox 36, my firewall was flooding asking me to allow external connections from the Internet to my browser. Looking at it more closely, Comodo Firewall indicates that external websites are trying to connect to Firefox, port 53 to an arbitrary port on my machine.

    If I disable the option FF36 new network.dns.get - ttl, it stops. I can't find any documentation or help on this option.

    Why Firefox do this? Is Comodo incorrect when he labels it as an external connection attempt? (It has normally been extremely good to differentiate the incoming and outgoing traffic). I guess that Firefox is trying to determine the TTL for DNS caching, but it is not make sense why DNS servers then try to connect to me.

    I am reluctant to create a firewall rule to that arbitrary Internet connections on my machine are OK as long as their origin on port 53, tips on how to manage all that this new feature is firmly States would be appreciated.

    Thanks in advance for any help.

    Hi grammarye,

    Yes, you're right in thinking that Firefox is trying to find the TTL value. This is new in Firefox 36 behavior and was presented as services frequently changing DNS records (such as Cloudflare) were not working properly for Firefox users.

    Firefox makes asynchronous DNS searches - which means it will make a DNS query and then proceed to perform another task instead of waiting for an answer.

    Your ISP DNS server puts in cache only TTL an area for a short time, so if it does not the current LIFE expectancy, he will interview with other DNS servers to find.

    IANAE, but probably what is happening is:

    1. Firefox tries to find the DNS record for the domain that you want to connect to
    2. Your ISP DNS server does not have the current LIFE expectancy, then connects with other DNS servers to find
    3. During this time, Firefox lingers with something else
    4. DNS server, then reconnects to give you full DNS, including the TTL check
    5. Comodo sees the packets of the DNS server and panic

    I completely agree that arbitrary ports of white list is a bad idea, but in this case, the behavior is completely harmless.

    You can want to whitelist Firefox in your Comodo Firewall, or continue to let network.dns.get - disabled ttl.

    (edited to fix broken links and add a sentence)

  • Using google DNS servers creates a security hole?

    Hello

    So I had slight problems with browsing the internet. Although it is not so frequent, sometimes I can not open sites and I encounter the message "safari could not find server'. Therefore, I thought that by using the dns servers of Google (8.8.8.8 8.8.4.4) could help with that. However, I wonder if using a public dns server instead of the ISP can harm to the security of my camera somehow.

    Thanks in advance

    Do not be afraid.

  • blank static ip dns servers

    I have a XP SP3 workstation I need to assign a static IP address.  Our network has a domain with 2 DNS servers.   I entered the necessary information for the IP address, subnet mask, gateway by default and DNS on the XP machine, then rebooted.  After that, I have no internet access and get the error event 1053 and 15 in the application log.  I checked the properties of TCP and DNS fields are empty (I'm positive, I put them properly and have retried it a dozen times).  If I set the NIC in DHCP, it works fine and no error is generated.  I tried using "netsh int ip reset c:\resetlog.txt" TCP reset but still not the same error.  This is a new installation, so I know there is not no virus or malware, the origin of the problem.  I was going to try to replace the NETWORK card, but the system is a small form factor box so I have to buy one and wanted to make sure that could solve the problem before the $.

    Tried that too... no dice... I found the cause and solved the problem.  Our network is running Symantec Endpoint Protection antivirus/malware protection.  There is a feature in version 12.1 called Sonar that protects against network intrusions.  Politics on the affected workstation has been configured to block changes DNS... where the DNS settings Virgin when I tried to set them manually.  I have changed the policy to allow DNS changes, entered the IP subnet gateway and DNS, restarted, and... It's working now!  Thank you O of Cameron and PML for your help.

  • Name for name resolution? has expired after no configured DNS servers responded.

    Hello

    I just bought an Acer Aspire 571PG V5.  Whenever I do anything that involves the use of the radio I usually get the following error in the Windows system event log:

    "The name resolution for the community.acer.com name exceeded after no configured DNS servers responded".

    The address featured in changes to error messages according to what I'm trying to access the website.  In this case every 30 seconds or more.  The error ID is 1014, and the Source is 'DNS Client events'.  I'm not sure what the problem.  I have two other laptops on my home network using the same router and they are fine, I've never had a problem with them.

    Has anyone else encountered this problem?

    Kind regards

    Chris

    Hello

    Just to inform that I had this work.  Even though I had brought just the laptop today, it seems readers wireless on it was already outdated.  I downloaded readers wireless updated from the Acer support site and I don't have this particular problem.

    Kind regards

    Chris

  • Error 105 - unable to resolve the addresses of DNS servers

    Hello! I'm sorry from the start for many stupid questions, I'll ask. I am a beginner :) I don't know if my rooter is the problem or the network cable, when I use cable internet, it works (bad but it works). When I try to go with my router (d-link dir-635) it appears the error 105. I tried all your suggestions, but still nothing. I can do something else or my rooter is dead? PS: I am on Windows 7. Sorry to bother you again!

    Hello

    Please contact Microsoft Community.

    According to the description, it looks like you cannot resolve the address of DNS servers. The probable cause of this problem may be due to the DNS.

    I have a couple of steps that should help you to solve this problem.

    Method 1:

    Try the resolution of the problems mentioned in this link

    Using the troubleshooter from network in Windows 7

    http://Windows.Microsoft.com/en-us/Windows7/using-the-network-troubleshooter-in-Windows-7

    Method 2:

    Visit this link and see "How can I clear the DNS cache?

    http://Windows.Microsoft.com/en-us/Windows7/DNS-domain-name-system-frequently-asked-questions

    Method 3:

    Try to assign the DNS manually and check

    To change the settings of the adapter wireless network connections.

    a. Click Start, type network and sharing Center in the start search box and press ENTER.

    b. click on change settings card, right click on wireless network connection and click on Properties.

    c. Select Internet version 4 Protocol, click Properties.

    d. place a next point to use the following dns server address.

    change the preferred dns 208.67.222.222 and dns auxiliary as 208.67.222.220 and click on validate the output parameter and click on ok.

    I hope this helps. If you have questions more related to Windows, feel free to post here at Microsoft Community.

  • FQDNs for ESX environment when DNS servers are VMS within the ESX environment

    Hello

    I was wondering,

    When the implementation of a new infrastructure from scratch, with an ESX cluster from scratch

    and when the servers DNS themselves will run inside the cluster,

    Then, it is advisable to use IP addresses instead of the domain name COMPLETE for the right ESX environment?

    Here's what I've done so far:

    -installed 1 ESX host

    -installed donain controller as VM

    -installed PSC and VCSA

    -created the new cluster

    -installed the second ESX host, added to the cluster.

    I installed a VM DC as the first thing after the installation of the initial ESX host, I could have started using the domain name COMPLETE for the ESX environment at this time.

    However, I didn't do it.

    For installation of the VCSA and when you add ESX hosts to the cluster, I used IP addresses instead of the FQDN names.

    It seems stupid and dangerous for me to use domain COMPLETE the ESX hosts themselves, because the domain controller is running in the cluster.

    So I used IP addresses only to ensure the ESX HA cluster and the characteristics of heartbeat stay ok if something were to happen to the DNS server.

    However, the VCSA installation and when you add hosts to the cluster,.

    the MISTLETOE gave me a warning, indicating that it is preferable to provide a FULL domain instead of an IP address name.

    I am of the opinion that if you have no physical DNS servers, it is not a good idea.

    My opinion is that when your nameservers inside the ESX cluster itself and you do not have 2 redundant external DNS servers, so it is not wise to use the FQDN for your ESX hosts, PSC and VCSA setup.

    In my view, using the property intellectual property is much safer in this case.

    I was wondering what is your angle on it.

    Do you see the same way, or have different opinions?

    Hi smetter,.

    It is advisable to have a working DNS for vSphere environment however the use of DNS for things like vSphere HA have been removed in more recent versions of the product. Refer to the section of the guidelines of the general network of this document for more details: https://www.vmware.com/files/pdf/techpaper/vmw-vsphere-high-availability.pdf

    With this in mind I wouldn't be worried about use of FULL domain for the addition of services like the ESX host, etc.. Failure where HA would be restarting the virtual computer, there is no dependency on DNS so it will continue to work as expected and, subject to the availability of resources the virtual machine starts on another host.

    According to your vSphere licenses, you may also like to consider the implementation of anti-affinity DRS VM to keep your DNS Appart servers and on different hosts. This can prevent your servers DNS are declining when the failure of a host. You must have Enterprise edition or later for this.

    Kind regards.

  • from the hypervisor can ping of the gw &amp; dns servers

    I moved the 1 shelf to another hypervisor

    Now from the hypervisor can ping of the gw & dns servers

    But with I can't ssh, or port 443

    any suggestions?

    I have the system restore. That fixed it.

  • The course does not send the results of the tests and reports system (Saba) after trial. The course remained "incomplete". What can you recommend?

    The course does not send the results of the tests and reports system (Saba) after trial. The course remained "incomplete". What can you recommend?

    Ok.  So you're screenshot compared to SCORM clouds now shows you're scoring 100% in the quiz, but your state of completion will still come out incomplete.  Then of course, your quiz notification settings not award success based on passing the test.

    Try to set your quiz the way I show this screenshot using SCORM 1.2 instead of 2004.

  • Export-csv system.string [] question

    I have a powercli script I wrote to collect virtual switch information and portgroup.

    Most work however the information active and reserve nic shows in the console

    For example ActiveNic: {vmnic4}

    However, in the CSV file it shows up as @{ActiveNic = System.String []} without the information real vmnic

    Please let me know how to get the active and standby vmnic info in the CSV here is the script

    SE connect-VIServer vcenter

    $report = @)

    $ESXhosts = Get-VMHost

    {foreach ($esxhost to $ESXhosts)

    $Vswitches = $esxhost | Get-Virtualswitch

    {foreach ($vswitch to $vswitches)

    $Portgroups = $vswitch | Get-VirtualPortGroup

    {foreach ($portgroup to $Portgroups)

    $nicteam = Get-NicTeamingPolicy $portgroup

    $row = "" | Select Cluster, Vswitch, Portgroup, Vlan, ActiveNic, Esxhost, Standbynic

    $row. Cluster = $esxhost. Parent

    $row. ESxhost = $esxhost.name

    $row. Vswitch = $Vswitch.Name

    $row.portgroup = $portgroup.name

    $row. VLAN is $portgroup. VLANID

    $row. Activenic = $nicteam.activenic

    $row. Standbynic = $nicteam. StandbyNic

    {$report += $row}

    }

    }

    $report | Export-Csv c:\psresults\host_portgroups_clustr_standby.csv

    The Export-Csv cmdlet can manage properties that are arrays or complex objects correctly.

    A way around this is to convert the table into a single string.

    Something like that

    Connect-VIServer vcenter $report = @()
    $ESXhosts = Get-VMHost foreach ($esxhost in $ESXhosts) {
      $Vswitches = $esxhost | Get-Virtualswitch  foreach($vswitch in $vswitches){
        $Portgroups = $vswitch | Get-VirtualPortGroup    foreach ($portgroup in $Portgroups){
          $nicteam = Get-NicTeamingPolicy $portgroup      $row = "" | select Cluster, Esxhost, Vswitch, Portgroup,Vlan,ActiveNic,Standbynic      $row.Cluster = $esxhost.Parent      $row.ESxhost = $esxhost.name     $row.Vswitch = $Vswitch.Name      $row.portgroup = $portgroup.name      $row.Vlan = $portgroup.Vlanid      $row.Activenic= [string]::Join(',',$nicteam.activenic)
          $row.Standbynic=[string]::Join(',',$nicteam.StandbyNic)
          $report += $row}
      }
    }
    
    $report | Export-Csv c:\psresults\host_portgroups_clustr_standby.csv
    
  • No internet connection, no dns servers.  Help, please!

    Hello

    I have an Apple Airport Extreme, I had used with internet of Cox for the past 2 years.  I recently moved and had to sign with Time Warner Cable.  I decided to buy my own modem this time, but were not able to configure my wireless network.  I can connect via my wireless hard connection ethernet (via the router) very well.  The led is green on the internet connection, but the flashing orange on the Airport Extreme.  He said that the problem is not internet connection (which is said to pass the modem which does not work) and not dns servers.  I can put in the dns servers (I've tried a few different things to include 8.8.8.8 and 8.8.8.4) who get rid of this message, but I still have the first internet connection.  My Version of Airport utility is 6.3.5, my modem is a Motorola Surfboard SB6141.

    Help, please!

    The Motorola modem will have need of a power extended down with Time Warner service in order to obtain a new valid IP address of the Server Time Warner... and... Ince you have changed providers and modem... AirPort Extreme will be reset to the factory settings and then set it up again, so that it "learn" the new settings he needs.

    If you decide you want to try our tips...

    Turning off the modem by pulling on the power cord to the back of the unit

    Unplug the co - ax cable and Ethernet cable so

    Let off for at least 30 minutes the modem... 60 would be better... more won't hurt

    While the modem is turned off... and with the AirPort Extreme on for a few minutes... Press and hold the reset button on the back of the airport for 7-8 seconds, then release and allow a minute for the airport restart to a slow status of amber light, flashes.

    Then, turn off the AirPort Extreme

    Once the modem has been turned off for at least 30 minutes, plug the co - ax cable and Ethernet from the modem into the WAN "O" on the AirPort Extreme port cable

    Turn on the modem and let it run for at least 10 minutes by itself

    Then, turn on the AirPort Extreme and let it run a few minutes

    Set up AirPort Extreme again and check to see if everything is operational

  • Policy update for several networks with specific DNS servers

    I have a network of medium size with 5 locations with different IP addresses. All the sites host their own DNS servers and connect directly through a dedicated VLAN access provider.

    Main site 10.1.1.1 255.0.0.0
    Remote site 1 192.168.100.1 255.255.255.0
    Remote site 2 192.168.101.1 255.255.255.0
    Remote site 3 192.168.102.1 255.255.255.0
    Remote site 4 192.168.103.1 255.255.255.0

    All sites can be managed via the main site, but have their own DNS servers on-site.

    My goal is to point all computers and devices on a new DNS server for their previous static assignment. (XP and later)

    My question is can I use GP or DHCP * for information push on each apparatus, this DNS server that makes site specific without having to travel to these places?

    Requirements:

    All devices of 10.1.1.1 10.1.1.2 to 10.1.1.4 change (old decom 2 k 3 Server)

    At each location of 192 DNS servers will have to point the secondary server to 10.1.1.4

    Handheld devices will use 10.1.1.4 as primary and 10.1.1.3 as secondary.

    Devices at each site shall keep their respective DNS server.

    * If I use DHCP to change the information on a per level of scope, I can use GP to force computers with locally defined static assignments update the static DHCP assignments

    Bonus: If someone can give me an estimate on how much traffic/band bandwidth network that it would create would be great because I consider well shift assignments as I am a business 24 hours a day.

    Hello

    I advise you to repost the question to the TechNet forum for assistance.

    http://social.technet.Microsoft.com/forums/en-us/home?category=itmanager

    Related topics:

    http://www.winvistatips.com/threads/push-new-scope-settings-from-DHCP-server-to-all-reservations.725644/

    How to use DHCP to provide routing and remote access with the additional DHCP Options Clients

    http://support.Microsoft.com/kb/232703/en-us

  • Linksys E3000 (changed to 199.182.166.168 DNS servers) No. Playstation Network Access

    For a month I got weird pop ups on my IPAD, ANDROID phones, desktop computers AND home. I just thought that I had a bad month and I need to spend more time with my individual devices and get clean them. I then noticed recently, last week I was unable to connect to the Playstation network (NAT Type failed, the Internet connection Test failed). This was happening on my PS3 and PS4. I direct connect of PS4 and PS3 to my Modem cable from Time Warner and I have no problem. Everything works fine. But when connected to wireless or wired to my Linksys e3000... no dice.

    I connect to my router and so some research. I noticed that my DNS servers are 199.182.166.168 and 199.182.166.169. I decided the router and then restart my cable modem. Routers Gets a new address and but there are still some problems with the connection to the network Playstaiton (could be downwards). I noticed that my IP DNS address is different.2xx.xxx.xxx.xxx.  I restore the configuration on the router and DNS goes back to 199.182.166.168.  This is all the information I have at the moment. When I get home tonight I'll have more information.

    Does anyone else have this problem?

    Is the router configured for DNS custom or did you automatically detect DNS of the ISP service and ISP modem?

    What modem to ISP Mfr and model # do you have?

    You could ask the ISP service as well about it. Usually they don't change DNS very often.

    It is recommended to test for other DNS services if you want to use different DNS, you can use this:

    http://www.grc.com/DNS/benchmark.htm

    or http://code.google.com/p/namebench/

Maybe you are looking for

  • iMessage problem does not receive past messages

    I recently left the country for a month had to remove my sim card to avoid any roaming charges. When I came back I put my card back in and realized that I had not received one of my last iMessages or missed calls a month. Even during my trip, I had w

  • AirDrop does not work between Mac mini end of 2014 and 6 s iPhone more

    Hello! I'm here for the first time. A little more last year, I bought a Mac mini end of 2014 with Core i5 clocked at 2.6 GHz, 8 GB RAM and 5400 RPM HARD drive. I replaced the HDD for an SSD, Samsung EVO 850 250 GB, to be correct. I also have an iPhon

  • Slovakia with confucion Slovenian flag

    Dear people of Skype, there is an error in link http://www.skype.com/en/premium/?intsrc=client-_-windows-_-6.3.0.105-_-getpremium in the section country location you can call. It was country Slovakia with Slovenian flag :-). Jakub from Slovakia ([und

  • is there a tool to report all add-ins with version information

    HelloI would like to be able to document all the add-ins, as well as version information as well as any other readily available information which is part of the installation of firefox. I am aware that there is a box to tools-addins, but I want to be

  • Re: Satellite A100-003 - need of Windows Vista 64-bit drivers

    I want to upgrade my OS to Vista 64-bit, but I can't find it anywhereI want the functions to work such as media buttons (stop, play,... etc.)I got my cell phone as a gift from the Middle East, and now I'm having hard to upgrade This is the Satellite