-
-
Save StefanScherer/adbb421dc0adca75b49e0031a99595a5 to your computer and use it in GitHub Desktop.
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 |
I'm not sure what the problem is. But every win 10 box that I've downloaded from vagrant appears to prevent me from configuring auto-logon. I first download the box, do a vagrant up with (even with the vagrant file in this original post) but don't get it to autologon. I even manually checked and confirmed that these registry keys are set correctly:
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name AutoAdminLogon -Value 1
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultUserName -Value "vagrant"
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultPassword -Value "vagrant"
What would prevent vagrant boxes that were downloaded from allowing autologon to be confirgured. I also did it via the netplwiz. I appreciate you giving me your scripts but I don't think it will solve the issue because those registry keys are already set and still it doesn't work. I have to manually login every time.
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.
Dunno what's your issue, but perhaps my Vagrantfile / provisioning.ps1 in https://github.com/chkpnt/MSEdge-Vagrant might help, which is used for a similar provisioning.