Skip to content

Commit 4b10f94

Browse files
committed
VM Windows Firewall configuration with PowerShell
1 parent 16b3140 commit 4b10f94

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

vagrant/win10-chromium-nvda/Vagrantfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ Vagrant.configure("2") do |config|
1818
type: "shell",
1919
inline: <<-SHELL
2020
\$ErrorActionPreference = "Stop"
21-
netsh advfirewall firewall add rule name="Allow WinRM" localport=5985 protocol=tcp dir=in action=allow
21+
echo "Windows Firewall rules..."
22+
New-NetFirewallRule -Enabled True -Action Allow -Direction Inbound -DisplayName "Allow WinRM" -Protocol TCP -LocalPort 5985 | Out-Null
23+
New-NetFirewallRule -Enabled True -Action Allow -Direction Inbound -DisplayName "Allow nodejs" -Program "c:\\Program Files\\nodejs\\node.exe" | Out-Null
24+
New-NetFirewallRule -Enabled True -Action Allow -Direction Inbound -DisplayName "Allow java" -Program "c:\\jdk-17.0.2\\bin\\java.exe" | Out-Null
2225
2326
echo "Configuring auto-login..."
2427
Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon' -Name DefaultUserName -Type String -Value IEUser
@@ -86,7 +89,6 @@ namespace Win32Api
8689
echo "Installing node.js..."
8790
\$p = Start-Process msiexec.exe -ArgumentList "/I","c:\\vagrant\\software\\node.msi","/quiet" -Wait -NoNewWindow -PassThru
8891
if ( \$p.ExitCode -ne 0 ) { exit \$p.ExitCode }
89-
netsh advfirewall firewall add rule name="Allow nodejs" dir=in action=allow program="c:\\Program Files\\nodejs\\node.exe" enable=yes
9092
\$Env:PATH += ";c:\\Program Files\\nodejs"
9193
9294
echo "Installing assistive-playwright-server..."
@@ -103,7 +105,6 @@ namespace Win32Api
103105
104106
echo "Installing java..."
105107
Expand-Archive -Path C:\\vagrant\\software\\openjdk.zip -DestinationPath C:\\
106-
netsh advfirewall firewall add rule name="Allow java" dir=in action=allow program="c:\\jdk-17.0.2\\bin\\java.exe" enable=yes
107108
108109
echo "Installing selenium-server..."
109110
Copy-Item "C:\\vagrant\\software\\selenium-server.jar" -Destination C:\\

0 commit comments

Comments
 (0)