Hello,
I was not able to find something useful to solve this issue so I will try it here.
I've a fresh installation of Vagrant (no plugins) on my host, but the response of the CLI is very very slow.
For example it takes 19 seconds to get the output of "vagrant version":
PS > Measure-Command { vagrant version }
Days : 0
Hours : 0
Minutes : 0
Seconds : 19
Milliseconds : 460
Ticks : 194606842
TotalDays : 0,000225239400462963
TotalHours : 0,00540574561111111
TotalMinutes : 0,324344736666667
TotalSeconds : 19,4606842
TotalMilliseconds : 19460,6842
Environment: Windows 10 2004 Build 19041.450 (32 GB RAM, Core i7), Vagrant 2.2.10, VirtualBox 6.1.12.
Thanks in advance.
Kind regards
Marcel
Same here; running vagrant version takes about 7 seconds.
Environment: Windows 10 1909 (18363.1139), 16GB RAM, Core i7, Vagrant 2.2.10, VirtualBox 6.1.8.
PS> measure-command { vagrant version }
Days : 0
Hours : 0
Minutes : 0
Seconds : 7
Milliseconds : 423
Ticks : 74233471
TotalDays : 8.5918369212963E-05
TotalHours : 0.00206204086111111
TotalMinutes : 0.123722451666667
TotalSeconds : 7.4233471
TotalMilliseconds : 7423.3471
Tried adding C:\HashiCorp to the virus scan exclusion list, but no difference.
This may be due to powershell compiling assemblies on startup which is causing the delay. Precompiling them can resolve the issue if it is indeed the root cause: https://serverfault.com/questions/761301/calling-powershell-exe-is-extremely-slow/761473#761473
@chrisroberts Thanks for the tip, but Vagrant is also slow using normal cmd.exe.
C:\>cmd /v:on /c "echo !TIME! & vagrant version & echo !TIME!"
7:38:16.06
Installed Version: 2.2.10
Latest Version: 2.2.10
You're running an up-to-date version of Vagrant!
7:38:22.76
Not as accurate as measure-command, but it's taking about 7 seconds.
I'm thinking it's a problem running the embedded ruby environment on Windows that's slow...
Using cmd it takes 19 seconds on my notebook:
cmd /v:on /c "echo !TIME! & vagrant version & echo !TIME!"
10:42:59,13
Installed Version: 2.2.10
Latest Version: 2.2.10
You're running an up-to-date version of Vagrant!
10:43:18,49
@yasny / @keilma It is not an issue with running Vagrant under powershell or cmd. Vagrant executes powershell commands on Windows to determine things like available providers and user permissions. If powershell itself is slow to start, then it will result in Vagrant being slow as well. This is where precompiling the assemblies can help.
Hi @chrisroberts,
normal powershell operations or other scripts are working normal on my system. In the thread on serverfault it takes ~7 seconds for a write-host, on my host it's done in miliseconds:
PS> measure-command { pwsh "Write-Host test" }
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 330
Ticks : 3302527
TotalDays : 3,82236921296296E-06
TotalHours : 9,17368611111111E-05
TotalMinutes : 0,00550421166666667
TotalSeconds : 0,3302527
TotalMilliseconds : 330,2527
@chrisroberts Thanks for your input. Do you have any other suggestions? It's really difficult to work with Vagrant on Windows :(
Difficult? Not usable here.
I got 28 sec for "vagarant version".
When I run full script (provision docker-compose + run docker-compose.yml) docker it takes ~40minutes.
After that "vagrant ssh" takes a very long time to connect.
Wonder how you guys use it on Windows.
Edit: that information above is for my work machine. For my much less powerful home PC, it's approximately 3 times faster. Maybe there is some big-brother s/w in between
I see people in this bug report performing measurements on vagrant version, but that won't be accurate at all because it performs an HTTP request to Vagrant to fetch the latest version, so you'll have a variable extra delay from that request. Personally, I test vagrant help instead.
I did find out that it's (for some reason) faster if Vagrant is running elevated (with administrator permissions):

There also doesn't seem to be any difference between running in Windows 10's pre-installed PowerShell or PowerShell 7, because it will ALWAYS call out to C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.
Testing the command inside of a Vagrant environment (in this case Laravel Homestead) seems to make it run even faster:

I also find the slow vagrant cli quit annoying, especially vagrant help. I normally get about 2.3s with the measure-command. Every time I use vagrant, I lose focus as it takes so long to complete any command that I switch tasks and get distracted.
I used SysInternals Process Monitor to record the events, filtering on vagrant.exe, ruby.exe, and powershell.exe.

It shows that majority of the execution time is the ruby process. I think the root cause is that Ruby, at least on Windows, is very slow. The PowerShell processes take a lot less time than ruby. The vagrant.exe wrapper takes very small time.
Please remove the needs-repo and waiting-reply labels as clear repo steps have been provided and powershell has been eliminated.
We experience same delay problems. We have stopped using any vagrant commands which have alternatives on windows. I.E. vagrant ssh we use ssh directly on windows to connect to VM. The biggest issue for us is rsync. We need to send files often from Windows Vagrant Host to VM. Running vagrant rsync almost every 5 minutes drives us crazy.
We experience same delay problems. We have stopped using any vagrant commands which have alternatives on windows. I.E. vagrant ssh we use ssh directly on windows to connect to VM. The biggest issue for us is rsync. We need to send files often from Windows Vagrant Host to VM. Running vagrant rsync almost every 5 minutes drives us crazy.
@skalinkin Just use rsync directly. Its a binary packaged in vagrant. Or you can get cwRsync, msys2 rsync etc.
Most helpful comment
Difficult? Not usable here.