Docker Community Forums

Share and learn in the Docker community.

The VM couldn't get an IP address after 60 tries ... again


(Jzoss) #1

I’ve read some of the other threads, but I am still having this issue… I just installed the beta for the first time and I can get the ip address sorted out… You would be my hero if you could tell me what I am doing wrong.

Here are my logs

[11:39:18.157][Program ][Info ] Version 1.11.1-beta11 (build: 2789)
[11:39:18.157][Program ][Info ] Starting on: 5/11/2016 11:39:18 AM
[11:39:18.158][Program ][Info ] Resources: C:\Program Files\Docker\Docker\Resources
[11:39:18.158][Program ][Info ] OS: Windows 10 Pro
[11:39:18.159][Program ][Info ] Edition: Professional
[11:39:18.159][Program ][Info ] Id: 1511
[11:39:18.159][Program ][Info ] Build: 10586
[11:39:18.159][Program ][Info ] BuildLabName: 10586.212.amd64fre.th2_release_sec.160328-1908
[11:39:18.161][Program ][Info ] Mixpanel Id: 657B739C-2704-4E1A-A1B8-AC3A4CD61065
[11:39:18.163][Program ][Info ] Sha1: b0bc231ec0337a84cc1ce50f51df77f9b0f5c993
[11:39:18.163][Program ][Info ] You can send feedback, including this log file, at https://forums.docker.com/c/docker-for-windows
[11:39:18.346][Mixpanel ][Info ] Tracking: appLaunched
[11:39:19.440][Mixpanel ][Info ] Tracking: heartbeat
[11:39:19.441][BackendServer ][Info ] Started
[11:39:19.555][NamedPipeClient][Info ] Sending Version()…
[11:39:19.557][NamedPipeServer][Info ] Version()
[11:39:19.557][NamedPipeServer][Info ] Version done.
[11:39:19.558][NamedPipeClient][Info ] Received response for Version: Version 1.11.1-beta11 (build: 2789)
[11:39:19.558][NamedPipeClient][Info ] Sending CheckInstallation()…
[11:39:19.558][NamedPipeServer][Info ] CheckInstallation()
[11:39:19.559][HyperV ][Info ] Check Hyper-V Windows optional feature
[11:39:19.560][PowerShell ][Info ] Run script…
[11:39:20.525][HyperV ][Info ] Hyper-V Windows feature is enabled
[11:39:20.526][NamedPipeServer][Info ] CheckInstallation done.
[11:39:20.526][NamedPipeClient][Info ] Received response for CheckInstallation:
[11:39:20.526][NamedPipeClient][Info ] Sending CheckHyperVState()…
[11:39:20.527][NamedPipeServer][Info ] CheckHyperVState()
[11:39:20.527][HyperV ][Info ] Check Hyper-V Service State
[11:39:20.535][PowerShell ][Info ] Run script with parameters: -Check True…
[11:39:23.937][HyperV ][Info ] Hyper-V is running and responding
[11:39:23.937][HyperV ][Info ] Hyper-V is running
[11:39:23.937][NamedPipeServer][Info ] CheckHyperVState done.
[11:39:23.937][NamedPipeClient][Info ] Received response for CheckHyperVState:
[11:39:24.095][Authentication ][Info ] Checking token
[11:39:24.339][Authentication ][Info ] Token is valid
[11:39:24.440][Updater ][Info ] Checking for updates on the Beta channel…
[11:39:24.441][Notifications ][Info ] Docker is Initializing…
[11:39:24.451][NamedPipeClient][Info ] Sending Stop()…
[11:39:24.452][NamedPipeServer][Info ] Stop()
[11:39:24.452][HyperV ][Info ] Stop
[11:39:24.453][PowerShell ][Info ] Run script with parameters: -Stop True…
[11:39:25.110][HyperV ][Info ] Kill VM MobyLinuxVM…
[11:39:25.135][HyperV ][Info ] VM MobyLinuxVM is stopped
[11:39:25.138][Firewall ][Info ] Closing ports…
[11:39:25.140][PowerShell ][Info ] Run script…
[11:39:25.226][Updater ][Info ] Found remote version. Version = 1.11.1.2789
[11:39:25.226][Updater ][Info ] Local version is up to date.
[11:39:25.226][Updater ][Info ] Check for update done.
[11:39:26.202][Firewall ][Info ] Ports are closed
[11:39:26.203][NamedPipeServer][Info ] Stop done.
[11:39:26.203][NamedPipeClient][Info ] Received response for Stop:
[11:39:26.204][NamedPipeClient][Info ] Sending Start(2, 2048)…
[11:39:26.204][NamedPipeServer][Info ] Start(2, 2048)
[11:39:26.206][Firewall ][Info ] Opening ports for C:\Program Files\Docker\Docker\Resources\com.docker.proxy.exe and C:\Program Files\Docker\Docker\DockerForWindows.exe…
[11:39:26.206][PowerShell ][Info ] Run script…
[11:39:27.078][Firewall ][Info ] Ports are opened
[11:39:27.079][HyperV ][Info ] Create
[11:39:27.079][PowerShell ][Info ] Run script with parameters: -Create True -CPUs 2 -Memory 2048 -IsoFile C:\Program Files\Docker\Docker\Resources\mobylinux.iso…
[11:39:27.764][HyperV ][Info ] Using existing Switch: DockerNAT
[11:39:27.961][HyperV ][Info ] Using existing Switch IP address
[11:39:27.992][HyperV ][Info ] Using existing Net NAT: DockerNAT
[11:39:29.283][HyperV ][Info ] Using existing: MobyLinuxVM
[11:39:29.421][HyperV ][Info ] Setting MobyLinuxVM vm CPUs to 2 and Memory to 2048 MB
[11:39:29.426][Dhcp ][Info ] Dhcp starting on port 67, on interface vEthernet (DockerNAT)…
[11:39:29.473][Dhcp ][Info ] Dhcp started.
[11:39:29.475][Proxy ][Info ] Starting com.docker.proxy
[11:39:29.723][HyperV ][Info ] Start
[11:39:29.723][PowerShell ][Info ] Run script with parameters: -Start True…
[11:39:29.803][Proxy ][Info ] docker proxy (on deprecated port): ready
[11:39:29.804][Proxy ][Info ] poison pill: ready. Will kill ourself if parent process DockerForWindows.exe dies
[11:39:29.804][Proxy ][Info ] dns server: ready
[11:39:29.804][Proxy ][Info ] docker proxy: ready
[11:39:30.202][HyperV ][Info ] Starting VM MobyLinuxVM…
[11:39:30.692][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:31.706][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:32.719][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:33.732][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:34.809][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:35.941][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:36.954][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:37.967][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:38.979][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:40.055][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:41.242][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:42.255][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:43.268][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:44.280][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:45.357][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:46.503][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:47.515][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:48.529][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:49.547][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:50.632][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:51.775][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:52.789][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:53.800][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:54.812][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:55.886][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:57.078][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:58.092][HyperV ][Info ] Wait for the VM to get an IP address
[11:39:59.105][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:00.117][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:01.191][HyperV ][Info ] It’s taking too long. Let’s restart the VM…
[11:40:01.267][HyperV ][Info ] Shutdown VM MobyLinuxVM…
[11:40:02.719][HyperV ][Info ] VM MobyLinuxVM is stopped
[11:40:02.720][HyperV ][Info ] Starting VM MobyLinuxVM…
[11:40:02.924][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:04.062][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:05.105][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:06.117][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:07.212][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:08.224][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:09.441][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:10.453][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:11.495][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:12.622][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:13.633][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:14.790][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:15.802][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:16.817][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:17.934][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:18.955][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:20.116][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:21.153][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:22.180][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:23.322][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:24.349][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:25.583][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:26.611][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:27.649][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:28.741][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:29.767][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:30.960][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:31.980][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:32.991][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:34.140][HyperV ][Info ] Wait for the VM to get an IP address
[11:40:35.214][NamedPipeServer][Error ] Unable to executeStart: Failed to start VM “MobyLinuxVM”: The VM couldn’t get an IP address after 60 tries
[11:40:35.215][NamedPipeClient][Error ] Unable to sending Start: Failed to start VM “MobyLinuxVM”: The VM couldn’t get an IP address after 60 tries
[11:40:35.216][Notifications ][Error ] Error: Failed to start VM “MobyLinuxVM”: The VM couldn’t get an IP address after 60 tries
[11:40:44.662][Program ][Info ] Sending Bugsnag report f9eb2c26-b9d7-4666-9a97-de39a82fb8a0 …
[11:40:45.465][Program ][Info ] Bugsnag report sent
[11:41:44.390][Notifications ][Info ] Docker is resetting to default…
[11:41:44.401][NamedPipeClient][Info ] Sending Stop()…
[11:41:44.401][NamedPipeServer][Info ] Stop()
[11:41:44.402][HyperV ][Info ] Stop
[11:41:44.402][PowerShell ][Info ] Run script with parameters: -Stop True…
[11:41:45.086][HyperV ][Info ] Shutdown VM MobyLinuxVM…
[11:41:46.490][HyperV ][Info ] VM MobyLinuxVM is stopped
[11:41:46.495][Proxy ][Info ] Killing existing process com.docker.proxy with PID 7592
[11:41:46.496][Firewall ][Info ] Closing ports…
[11:41:46.496][PowerShell ][Info ] Run script…
[11:41:46.499][Proxy ][Info ]
[11:41:46.500][Proxy ][Info ]
[11:41:47.244][Firewall ][Info ] Ports are closed
[11:41:47.244][NamedPipeServer][Info ] Stop done.
[11:41:47.245][NamedPipeClient][Info ] Received response for Stop:
[11:41:47.245][NamedPipeClient][Info ] Sending Destroy(False)…
[11:41:47.246][NamedPipeServer][Info ] Destroy(False)
[11:41:47.246][HyperV ][Info ] Destroy
[11:41:47.247][PowerShell ][Info ] Run script with parameters: -Destroy True…
[11:41:47.682][HyperV ][Info ] Shutdown VM MobyLinuxVM…
[11:41:47.695][HyperV ][Info ] VM MobyLinuxVM is stopped
[11:41:47.697][HyperV ][Info ] Destroying Switch DockerNAT…
[11:41:49.270][HyperV ][Info ] Destroying Net NAT DockerNAT…
[11:41:49.290][HyperV ][Info ] Destroying VM MobyLinuxVM…
[11:41:49.365][NamedPipeServer][Info ] Destroy done.
[11:41:49.365][NamedPipeClient][Info ] Received response for Destroy:
[11:41:49.391][Cmd ][Info ]
[11:41:49.391][Cmd ][Info ] CMDKEY: Element not found.
[11:41:49.395][Notifications ][Info ] Docker is Initializing…
[11:41:49.405][NamedPipeClient][Info ] Sending Stop()…
[11:41:49.406][NamedPipeServer][Info ] Stop()
[11:41:49.406][HyperV ][Info ] Stop
[11:41:49.406][PowerShell ][Info ] Run script with parameters: -Stop True…
[11:41:49.855][HyperV ][Info ] VM MobyLinuxVM does not exist
[11:41:49.857][Firewall ][Info ] Closing ports…
[11:41:49.857][PowerShell ][Info ] Run script…
[11:41:50.446][Firewall ][Info ] Ports are closed
[11:41:50.446][NamedPipeServer][Info ] Stop done.
[11:41:50.446][NamedPipeClient][Info ] Received response for Stop:
[11:41:50.451][NamedPipeClient][Info ] Sending Start(2, 2048)…
[11:41:50.451][NamedPipeServer][Info ] Start(2, 2048)
[11:41:50.451][Firewall ][Info ] Opening ports for C:\Program Files\Docker\Docker\Resources\com.docker.proxy.exe and C:\Program Files\Docker\Docker\DockerForWindows.exe…
[11:41:50.452][PowerShell ][Info ] Run script…
[11:41:51.156][Firewall ][Info ] Ports are opened
[11:41:51.156][HyperV ][Info ] Create
[11:41:51.156][PowerShell ][Info ] Run script with parameters: -Create True -CPUs 2 -Memory 2048 -IsoFile C:\Program Files\Docker\Docker\Resources\mobylinux.iso…
[11:41:51.607][HyperV ][Info ] Enabled workaround for Build 10586 VMSwitch issue
[11:41:54.183][HyperV ][Info ] Creating Switch: DockerNAT…
[11:41:55.130][HyperV ][Info ] Switch created.
[11:41:55.286][HyperV ][Info ] Set IP address on switch
[11:41:55.304][HyperV ][Info ] Creating Net NAT: DockerNAT…
[11:41:55.339][HyperV ][Info ] Net NAT created.
[11:41:55.372][HyperV ][Info ] Creading dynamic VHD: C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx
[11:41:56.468][HyperV ][Info ] Creating VM MobyLinuxVM…
[11:41:58.037][HyperV ][Info ] VM created.
[11:41:58.038][Dhcp ][Info ] Dhcp starting on port 67, on interface vEthernet (DockerNAT)…
[11:41:58.081][Dhcp ][Error ] Unable to start the dhcp server: The requested address is not valid in its context. Will retry.
[11:41:58.582][Dhcp ][Info ] Dhcp started.
[11:41:58.584][Proxy ][Info ] Starting com.docker.proxy
[11:41:58.589][HyperV ][Info ] Start
[11:41:58.589][PowerShell ][Info ] Run script with parameters: -Start True…
[11:41:58.664][Proxy ][Info ] docker proxy (on deprecated port): ready
[11:41:58.664][Proxy ][Info ] dns server: ready
[11:41:58.664][Proxy ][Info ] poison pill: ready. Will kill ourself if parent process DockerForWindows.exe dies
[11:41:58.666][Proxy ][Info ] docker proxy: ready
[11:41:59.081][HyperV ][Info ] Starting VM MobyLinuxVM…
[11:41:59.311][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:00.323][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:01.355][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:02.429][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:03.614][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:04.690][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:05.703][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:06.717][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:07.777][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:08.995][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:10.055][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:11.090][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:12.126][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:13.154][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:14.324][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:15.356][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:16.393][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:17.405][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:18.470][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:19.681][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:20.758][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:21.781][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:22.804][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:23.861][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:25.151][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:26.209][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:27.254][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:28.283][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:29.368][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:30.560][HyperV ][Info ] It’s taking too long. Let’s restart the VM…
[11:42:30.619][HyperV ][Info ] Shutdown VM MobyLinuxVM…
[11:42:34.097][HyperV ][Info ] VM MobyLinuxVM is stopped
[11:42:34.098][HyperV ][Info ] Starting VM MobyLinuxVM…
[11:42:34.295][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:35.333][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:36.539][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:37.578][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:38.618][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:39.660][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:40.796][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:42.031][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:43.043][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:44.068][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:45.081][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:46.175][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:47.344][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:48.384][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:49.425][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:50.461][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:51.595][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:52.844][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:53.855][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:54.883][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:55.905][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:56.982][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:58.177][HyperV ][Info ] Wait for the VM to get an IP address
[11:42:59.210][HyperV ][Info ] Wait for the VM to get an IP address
[11:43:00.236][HyperV ][Info ] Wait for the VM to get an IP address
[11:43:01.261][HyperV ][Info ] Wait for the VM to get an IP address
[11:43:02.350][HyperV ][Info ] Wait for the VM to get an IP address
[11:43:03.569][HyperV ][Info ] Wait for the VM to get an IP address
[11:43:04.608][HyperV ][Info ] Wait for the VM to get an IP address
[11:43:05.645][HyperV ][Info ] Wait for the VM to get an IP address
[11:43:06.691][NamedPipeServer][Error ] Unable to executeStart: Failed to start VM “MobyLinuxVM”: The VM couldn’t get an IP address after 60 tries
[11:43:06.692][NamedPipeClient][Error ] Unable to sending Start: Failed to start VM “MobyLinuxVM”: The VM couldn’t get an IP address after 60 tries
[11:43:06.693][Notifications ][Error ] Error: Failed to start VM “MobyLinuxVM”: The VM couldn’t get an IP address after 60 tries
[11:43:06.694][Program ][Info ] Sending Bugsnag report 232f4f7c-998b-4ac1-9be1-03d47dc89f14 …
[11:43:07.157][Program ][Info ] Bugsnag report sent


(Streetmapp) #2

Do you have anything going on with your network like a VPN or any other virtualization going on with your computer? Adding additional networks into the picture seems to be responsible for some of the difficulties in getting things moving. Like for me, I presently cannot use Docker for Windows on my work PC when home and on the VPN.


(Jzoss) #3

Well I’m behind a terrible cooperate firewall but not always a vpn… Odd behavior … If I change the Virtual Switch to “External Network” I actually get it to get a ip address… It’s messes a few other things up. and i can’t download any images but… I get an ipaddress


(Fiberoptic) #4

I had the same problem, but I just solved it:
1/ remove openvpn
2/ remove purevpn
3/ remove all vpn in settings > VPN
4/ remove docker toolbox
5/ deactivate all windows firewalls
6/ reset to factory default or remove/reinstall docker for windows

Docker is up and running.

I just have to see what I can reinstall or activate.


(Karlriss) #6

I have the same problem on a fresh install of windows 10 x64.

This is what I did to replicate the problem

  • Fresh install of Win10 x64
  • Install Docker for Windows
  • Let Docker Install hyper-V
  • Restart
  • MobyLinuxVM failed to start, could not get IP address

My PC is not on a corporate network and not joined to a domain and no VPN is configured.

I don’t have any other hypervisors running other than Hyper-V.

I was able to get docker running by removing DockerNat and the mobyVM, restarting, then reinstalling Docker, but it failed to start again, after another reboot.


(Escufi) #7

Hello All,

What i did was increase tries on MobiLinux.ps

Lines from 375 to 389 (changes , line 376 & 382) , now works great

— code—

while ((Get-VMNetworkAdapter $VmName).IPAddresses.count -eq 0) {
if ($times -eq 120) {
Write-Output "It’s taking too long. Let’s restart the VM…"
Stop-MobyLinuxVM
Write-Output "Starting VM $VmName…"
Start-VM -VMName $VmName
} elseif ($times -eq 300) {
Fatal “The VM couldn’t get an IP address after $times tries”
}
Write-Output "Wait for the VM to get an IP address"
Start-Sleep -Seconds 1
$times++
}

—/code—