agent: |
ofnqtnUVpU24rBS4zjdiCheck Firewall Rules Blocking the connection on windows client machine side (Powershell)
Check Firewall Rules Blocking the connection on windows client machine side (Powershell)
There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
inputs
outputs
# Define the firewall rule name and port
$ruleName = "Allow OpenVPN UDP 1194"
$port = 1194
$protocol = "UDP"
$context.ctxprint("Checking for existing firewall rule for UDP traffic on port $port...")
# Check if a rule already exists for UDP traffic on port 1194
$existingRule = netsh advfirewall firewall show rule name=all | Select-String -Pattern "LocalPort.*$port", "RemotePort.*$port"
if ($existingRule) {
$context.ctxprint("Firewall rule for UDP traffic on port $port already exists. No action needed.")
} else {
$context.ctxprint("No existing firewall rule for UDP traffic on port $port. Adding a new rule...")
# Add the firewall rule to allow inbound UDP traffic on port 1194
$addRuleCommand = "netsh advfirewall firewall add rule name=`"$ruleName`" protocol=$protocol dir=in localport=$port action=allow"
Invoke-Expression $addRuleCommand | Out-Null
$context.ctxprint("Firewall rule successfully added to allow UDP traffic on port $port.")
$context.ctxprint("Verifying the newly added rule...")
# Verify the status of the newly added rule
$verifyRule = netsh advfirewall firewall show rule name="$ruleName"
$context.ctxprint("Verification complete. Details of the firewall rule for VPN Port ($port):")
$context.ctxprint($verifyRule)
}
$context.ctxprint("Script completed.")
copied