From 165ba4ae414f06b0b911232413f82536ca3814f4 Mon Sep 17 00:00:00 2001 From: Chris Long Date: Wed, 5 Aug 2020 00:28:30 -0700 Subject: [PATCH] Fixing fix-second-network.ps1 --- Vagrant/Vagrantfile | 2 +- Vagrant/scripts/fix-second-network.ps1 | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Vagrant/Vagrantfile b/Vagrant/Vagrantfile index 2b61768..3601edb 100644 --- a/Vagrant/Vagrantfile +++ b/Vagrant/Vagrantfile @@ -188,7 +188,7 @@ Vagrant.configure("2") do |config| cfg.winrm.retry_limit = 20 cfg.vm.network :private_network, ip: "192.168.38.104", gateway: "192.168.38.1", dns: "192.168.38.102" - cfg.vm.provision "shell", path: "scripts/fix-second-network.ps1", privileged: true, args: "-ip 192.168.38.104 -dns 8.8.8.8 -gateway 192.168.38.1" + cfg.vm.provision "shell", path: "scripts/fix-second-network.ps1", privileged: false, args: "-ip 192.168.38.104 -dns 8.8.8.8 -gateway 192.168.38.1" cfg.vm.provision "shell", path: "scripts/MakeWindows10GreatAgain.ps1", privileged: false cfg.vm.provision "shell", path: "scripts/provision.ps1", privileged: false cfg.vm.provision "reload" diff --git a/Vagrant/scripts/fix-second-network.ps1 b/Vagrant/scripts/fix-second-network.ps1 index 1fa0854..79126df 100755 --- a/Vagrant/scripts/fix-second-network.ps1 +++ b/Vagrant/scripts/fix-second-network.ps1 @@ -1,6 +1,8 @@ # Source: https://github.com/StefanScherer/adfs2 param ([String] $ip, [String] $dns, [String] $gateway) +Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Running fix-second-network.ps1..." + if ( (Get-NetAdapter | Select-Object -First 1 | Select-Object -ExpandProperty InterfaceDescription).Contains('Red Hat VirtIO')) { Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Setting Network Configuration for LibVirt interface" $subnet = $ip -replace "\.\d+$", "" @@ -18,10 +20,12 @@ if ( (Get-NetAdapter | Select-Object -First 1 | Select-Object -ExpandProperty In Write-Error "Could not find a interface with subnet $subnet.xx" } exit 0 +} Else { + Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) No VirtIO adapters, moving on..." } if (! (Test-Path 'C:\Program Files\VMware\VMware Tools') ) { - Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Nothing to do for other providers than VMware." + Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) VMware Tools not found, no need to continue. Exiting." exit 0 }