{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/5620","labels_url":"https://api.github.com/repos/mitchellh/vagrant/issues/5620/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/vagrant/issues/5620/comments","events_url":"https://api.github.com/repos/mitchellh/vagrant/issues/5620/events","html_url":"https://github.com/mitchellh/vagrant/issues/5620","id":70093894,"number":5620,"title":"The script get_network_config.ps1 fails on Hyper-V VMs with more than one network interface","user":{"login":"hagronnestad","id":1651402,"avatar_url":"https://avatars.githubusercontent.com/u/1651402?v=3","gravatar_id":"","url":"https://api.github.com/users/hagronnestad","html_url":"https://github.com/hagronnestad","followers_url":"https://api.github.com/users/hagronnestad/followers","following_url":"https://api.github.com/users/hagronnestad/following{/other_user}","gists_url":"https://api.github.com/users/hagronnestad/gists{/gist_id}","starred_url":"https://api.github.com/users/hagronnestad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hagronnestad/subscriptions","organizations_url":"https://api.github.com/users/hagronnestad/orgs","repos_url":"https://api.github.com/users/hagronnestad/repos","events_url":"https://api.github.com/users/hagronnestad/events{/privacy}","received_events_url":"https://api.github.com/users/hagronnestad/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mitchellh/vagrant/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/mitchellh/vagrant/labels/windows","name":"windows","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-22T10:52:17Z","updated_at":"2015-04-26T05:25:24Z","closed_at":null,"body":"The script `get_network_config.ps1` fails on Hyper-V VMs with more than one network interface. When the script fails no more configuration is done by Vagrant, which means that the `/vagrant` shared folder won't be mounted and any provisioners with the `run: \"always\"` flag won't run.\r\n\r\n##### `vagrant up` output:\r\n```\r\nBringing machine 'AppexSSHFS' up with 'hyperv' provider...\r\n==> AppexSSHFS: Verifying Hyper-V is enabled...\r\n==> AppexSSHFS: Starting the machine...\r\n==> AppexSSHFS: Waiting for the machine to report its IP address...\r\n    AppexSSHFS: Timeout: 120 seconds\r\nAn error occurred while executing a PowerShell script. This error\r\nis shown below. Please read the error message and see if this is\r\na configuration error with your system. If it is not, then please\r\nreport a bug.\r\n\r\nScript: get_network_config.ps1\r\nError:\r\n\r\nC:\\HashiCorp\\Vagrant\\embedded\\gems\\gems\\vagrant-1.7.2\\plugins\\providers\\hyperv\\scripts\\get_network_config.ps1 : Cannot index into a null array.\r\nAt line:1 char:1\r\n+ &('C:\\HashiCorp\\Vagrant\\embedded\\gems\\gems\\vagrant-1.7.2\\plugins\\providers\\hyper ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : InvalidOperation: (:) [get_network_config.ps1], RuntimeException\r\n    + FullyQualifiedErrorId : NullArray,get_network_config.ps1\r\n```"},"comment":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/comments/96324025","html_url":"https://github.com/mitchellh/vagrant/issues/5620#issuecomment-96324025","issue_url":"https://api.github.com/repos/mitchellh/vagrant/issues/5620","id":96324025,"user":{"login":"ssugar","id":7929462,"avatar_url":"https://avatars.githubusercontent.com/u/7929462?v=3","gravatar_id":"","url":"https://api.github.com/users/ssugar","html_url":"https://github.com/ssugar","followers_url":"https://api.github.com/users/ssugar/followers","following_url":"https://api.github.com/users/ssugar/following{/other_user}","gists_url":"https://api.github.com/users/ssugar/gists{/gist_id}","starred_url":"https://api.github.com/users/ssugar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssugar/subscriptions","organizations_url":"https://api.github.com/users/ssugar/orgs","repos_url":"https://api.github.com/users/ssugar/repos","events_url":"https://api.github.com/users/ssugar/events{/privacy}","received_events_url":"https://api.github.com/users/ssugar/received_events","type":"User","site_admin":false},"created_at":"2015-04-26T05:25:24Z","updated_at":"2015-04-26T05:25:24Z","body":"I just tested this on a HyperV VM with two network adapters, and the get_network_config.ps1 script isn't failing when I run it directly.  It returns the IP address of the first network adapter.\r\n\r\n![returns-first-interface-ip](https://cloud.githubusercontent.com/assets/7929462/7336009/5a2e3ebc-ec0e-11e4-9011-0001fd06471b.png)\r\n\r\nI was however able to get the same \"cannot index into a null array\" error when the VM wasn't getting an IP address via DHCP.\r\n\r\nWhat output do you get if you run the following command in powershell after you receive the \"Cannot index into a null array\" error?\r\n\r\n    Get-VM -Name \"name_of_your_vm\" | Get-VMNetworkAdadpter\r\n"}}