Skip to content

Instantly share code, notes, and snippets.

@santrancisco
Created March 19, 2018 00:55
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santrancisco/a7183470efa0e3412222670d0bfb3da5 to your computer and use it in GitHub Desktop.
Save santrancisco/a7183470efa0e3412222670d0bfb3da5 to your computer and use it in GitHub Desktop.
VagrantFile for official base image - windows 10 with Microsoft edge
# -*- 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
@yusufjonc07
Copy link

e oka qalesiz endi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment