Created
June 25, 2018 05:32
-
-
Save StefanScherer/adbb421dc0adca75b49e0031a99595a5 to your computer and use it in GitHub Desktop.
Turn on auto logon in a sysprepped Vagrant box
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure("2") do |config| | |
config.vm.define "tst" do |cfg| | |
cfg.vm.box = "StefanScherer/windows_2016" | |
cfg.vm.hostname = "tst" | |
cfg.vm.provider "virtualbox" do |vb| | |
vb.gui = true | |
vb.memory = "2048" | |
vb.linked_clone = true | |
end | |
cfg.vm.provision "shell", privileged: false, inline: <<-SHELL | |
Set-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" -Name AutoAdminLogon -Value 1 | |
Set-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" -Name DefaultUserName -Value "vagrant" | |
Set-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" -Name DefaultPassword -Value "vagrant" | |
Remove-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" -Name AutoAdminLogonCount -Confirm -ErrorAction SilentlyContinue | |
SHELL | |
cfg.vm.provision "reload" | |
cfg.vm.provision "shell", privileged: false, inline: <<-SHELL | |
iwr -useb https://chocolatey.org/install.ps1 | iex | |
choco install -y docker | |
docker --version | |
SHELL | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actually, after a glass of wine I was able to find the solution. For Hyper-V if you connect via an enhanced session, I guess it requires you to enter the password, but if you connect to the vm via a basic session, you don't need to enter the password. I don't understand by I'm happy to figure it out finally.
chocolatey/boxstarter#318
https://superuser.com/questions/709874/change-server-2012-display-resolution-inside-of-a-hyper-v-vm
Close the session if you have it open. Just 'orange x' it out. No need to shut it down.
When closed, some settings behaviors change. Right click on your VM and under 'Connect', there should now be 'Edit Session Settings'.
This should now bring you back to the dialog that lets you select resolution and attach local devices to the VM.
Once you have a new resolution selected, just re-connect.