Files
winos-config/vm_test/Vagrantfile
EthanShoeDev fd2b236a47 stuff
2025-12-30 00:17:52 -05:00

66 lines
2.3 KiB
Ruby

Vagrant.configure("2") do |config|
# Default credentials: vagrant / vagrant
config.vm.box = "gusztavvargadr/windows-11"
config.vm.box_version = "2511.0.0"
# # Sync the project root to C:/winos-config
# config.vm.synced_folder "..", "C:/winos-config", type: "smb"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider "virtualbox" do |vb|
vb.gui = true
vb.memory = "8192"
vb.cpus = 6
vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
vb.customize ["modifyvm", :id, "--vram", "256"]
end
config.vm.provider "hyperv" do |hv|
hv.memory = "8192"
hv.cpus = 6
end
# Provisioning script to install prerequisites
config.vm.provision "shell", privileged: true, powershell_args: "-ExecutionPolicy Bypass", inline: <<-SHELL
$winget_ids = @(
"Git.Git",
"Oven-sh.Bun",
"Microsoft.DSC",
"Casey.Just",
"junegunn.fzf",
"Microsoft.PowerShell"
)
Write-Host "Starting Time Service and syncing..."
# Ensure the service is started before syncing
Start-Service W32Time -ErrorAction SilentlyContinue
w32tm /resync /force
Write-Host "Resetting WinGet sources to fix 0x8a15000f..."
# This fixes the 'Data required by the source is missing' error
winget source reset --force
winget source update
foreach ($id in $winget_ids) {
Write-Host "Checking/Installing $id..."
# Added --accept-package-agreements and ensured we use the winget source
winget install --id $id --source winget --accept-source-agreements --accept-package-agreements --silent
}
SHELL
# Re-enable UAC and standard user prompts to stop automatic elevation
config.vm.provision "shell", privileged: true, powershell_args: "-ExecutionPolicy Bypass", inline: <<-SHELL
Write-Host "Restoring standard UAC behavior..."
$path = "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"
# 1 = Enable UAC (LUA)
Set-ItemProperty -Path $path -Name "EnableLUA" -Value 1
# 5 = Prompt for consent on the secure desktop (Standard behavior)
# 0 = Elevate without prompting (What your box is likely doing)
Set-ItemProperty -Path $path -Name "ConsentPromptBehaviorAdmin" -Value 5
Write-Host "UAC settings updated. You must restart the VM for this to take effect."
SHELL
end