Fixing fix-second-network.ps1

This commit is contained in:
Chris Long
2020-08-05 00:28:30 -07:00
parent 84c29f6739
commit 165ba4ae41
2 changed files with 6 additions and 2 deletions

2
Vagrant/Vagrantfile vendored
View File

@@ -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"

View File

@@ -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
}