-
-
Save santrancisco/a7183470efa0e3412222670d0bfb3da5 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
## Thanks to the discussion of various developers in this gist | |
## https://gist.github.com/andreptb/57e388df5e881937e62a#gistcomment-2346821 | |
## Especially clement-igonet. | |
### How to get Windows10 with Edge official base image run with WinRM and RDP: | |
# To use Windows10-Edge vagrant you will first need to download https://aka.ms/msedge.win10.vagrant (this is now a zip file) | |
# Execute `vagrant box add ./MsEdge\ -\ Win10.box --name Win10-official` after unzip the file to add the box to our base image list | |
# In the first run we will enable winrm and rdp: `communicator=ssh vagrant up` | |
# we can now run `vagrant rdp` to rdp to the box if required with IEUser:Passw0rd! | |
Vagrant.configure("2") do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at | |
# https://docs.vagrantup.com. | |
# Every Vagrant development environment requires a box. You can search for | |
# boxes at https://vagrantcloud.com/search. | |
# Configuring | |
config.vm.box = "Win10-official" | |
config.vm.guest = :windows | |
config.vm.communicator = ENV['communicator'] || "winrm" | |
config.winrm.username = "IEUser" | |
config.winrm.password = "Passw0rd!" | |
config.vm.boot_timeout = 600 | |
config.vm.graceful_halt_timeout = 600 | |
# Configuring | |
config.ssh.username="IEUser" | |
config.ssh.password="Passw0rd!" | |
config.ssh.insert_key = false | |
config.ssh.sudo_command = '' | |
config.ssh.shell = 'sh -l' | |
# Create a forwarded port mapping which allows access to a specific port | |
# within the machine from a port on the host machine. In the example below, | |
# accessing "localhost:8080" will access port 80 on the guest machine. | |
# config.vm.network "forwarded_port", guest: 80, host: 8080 | |
config.vm.network :forwarded_port, guest: 3389, host: 3389 | |
config.vm.network :forwarded_port, guest: 3389, host: 3389 | |
config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true | |
# Enabling RDP & WINRM: | |
config.vm.provision "shell", | |
binary: true, | |
privileged: false, | |
inline: <<-SHELL | |
# Enable RDP for IEUser | |
reg add "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f | |
netsh advfirewall firewall set rule group="remote desktop" new enable=yes | |
net localgroup "remote desktop users" IEUser /add | |
# winrm - Switch to private network | |
/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -InputFormat None -NoProfile -ExecutionPolicy Bypass -Command '$networkListManager = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}")) ; $connections = $networkListManager.GetNetworkConnections() ; $connections | % {$_.GetNetwork().SetCategory(1)}' | |
sc config winrm start= auto | |
cmd /C "winrm quickconfig -q" | |
exit | |
SHELL | |
end |
Hey, thanks for putting this up.
I followed your directions with a few corrections to run this on my server.
mkdir msedge
cd msedge
curl -O https://gist.github.com/santrancisco/a7183470efa0e3412222670d0bfb3da5/raw/ddc32f615e48b38244b67e7e1298406255935660/VagrantFile
mv VagrantFile Vagrantfile
curl -O https://az792536.vo.msecnd.net/vms/VMBuild_20180425/Vagrant/MSEdge/MSEdge.Win10.Vagrant.zip
unzip MSEdge.Win10.Vagrant.zip
vagrant box add "./MSEdge - Win10.box" --name Win10-official
communicator=ssh vagrant up
I port forwarded 3389 via ssh to my macbook then used the App Store to install Microsoft Remote Desktop.
Was having some trouble with @myers syntax on my MacBook Pro, not sure if it was a difference in software versions or what, but I tweaked the curl syntax to be a bit friendlier and more robust. The -L
says follow redirects, which is required when hitting the aka.ms URL. The -o
takes an argument to set the local filename so you don't have to mv
it later, and also so you know exactly what it will be for the next command. The -O
would normally create a local file with a name that matches whatever the remote server thinks it should be, but the -o
overrides that.
mkdir msedge
cd msedge
curl -L -o Vagrantfile -O https://gist.github.com/santrancisco/a7183470efa0e3412222670d0bfb3da5/raw/VagrantFile
# This pulls whatever the latest version of the gist is instead of a specific revision, useful if the box below changes and the Vagrantfile is updated to be compatible
curl -L -o MSEdge.Win10.Vagrant.zip -O https://aka.ms/msedge.win10.vagrant
# This could get us a newer version of the box with native SSH and WinRM which could negate the need for this hacky Vagrantfile
unzip MSEdge.Win10.Vagrant.zip
vagrant box add "./MSEdge - Win10.box" --name Win10-official
rm "./MSEdge - Win10.box"
# Saves some space, but keeps the zip in case we need it again, even though the zip doesn't save any space over the .box
communicator=ssh vagrant up
If you wanted to do this from Linux where maybe curl
isn't installed by default (Ubuntu/Debian), you can also use wget
.
mkdir msedge
cd msedge
wget -O Vagrantfile https://gist.github.com/santrancisco/a7183470efa0e3412222670d0bfb3da5/raw/VagrantFile
# This pulls whatever the latest version of the gist is instead of a specific revision, useful if the box below changes and the Vagrantfile is updated to be compatible
wget -O MSEdge.Win10.Vagrant.zip https://aka.ms/msedge.win10.vagrant
# This could get us a newer version of the box with native SSH and WinRM which could negate the need for this hacky Vagrantfile
unzip MSEdge.Win10.Vagrant.zip
vagrant box add "./MSEdge - Win10.box" --name Win10-official
rm "./MSEdge - Win10.box"
# Saves some space, but keeps the zip in case we need it again, even though the zip doesn't save any space over the .box
communicator=ssh vagrant up
e oka qalesiz endi
Download and unzip the file from microsoft to get .box file
Use this customed vagrantfile to run it and add winrm + rdp to the box so
vagrant rdp
would work