stuff
This commit is contained in:
32
vm_test/Vagrantfile
vendored
32
vm_test/Vagrantfile
vendored
@@ -3,9 +3,10 @@ Vagrant.configure("2") do |config|
|
||||
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"
|
||||
|
||||
# # 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"
|
||||
@@ -30,16 +31,35 @@ Vagrant.configure("2") do |config|
|
||||
"Microsoft.PowerShell"
|
||||
)
|
||||
|
||||
Write-Host "Forcing time synchronization to prevent certificate errors..."
|
||||
Write-Host "Starting Time Service and syncing..."
|
||||
# Ensure the service is started before syncing
|
||||
Start-Service W32Time -ErrorAction SilentlyContinue
|
||||
w32tm /resync /force
|
||||
|
||||
Write-Host "Refreshing WinGet source agreements..."
|
||||
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..."
|
||||
# Use --source winget to avoid disambiguation errors and --force to ensure installation
|
||||
# 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
|
||||
|
||||
@@ -23,4 +23,32 @@ reload:
|
||||
|
||||
# Destroy the vagrant box (forcefully)
|
||||
nuke:
|
||||
vagrant destroy -f
|
||||
vagrant destroy -f
|
||||
|
||||
# Halt the vagrant box
|
||||
halt:
|
||||
vagrant halt
|
||||
|
||||
# SSH into the vagrant box
|
||||
ssh:
|
||||
vagrant ssh
|
||||
|
||||
# WinRM into the vagrant box
|
||||
winrm:
|
||||
vagrant winrm
|
||||
|
||||
# Take a snapshot of the current VM state
|
||||
snapshot name:
|
||||
vagrant snapshot save {{name}}
|
||||
|
||||
# Restore the VM to a specific snapshot
|
||||
restore name:
|
||||
vagrant snapshot restore {{name}}
|
||||
|
||||
# List all snapshots for the VM
|
||||
snapshots:
|
||||
vagrant snapshot list
|
||||
|
||||
# Delete a specific snapshot
|
||||
snapshot-delete name:
|
||||
vagrant snapshot delete {{name}}
|
||||
|
||||
Reference in New Issue
Block a user