excel-planner/scripts/abrir_puerto_firewall.ps1
juan.pelaez 27d759ace8 Agregar integracion Excel-Planner con tablero RTC Sapian.
Puente Power Automate, servidor local del tablero HTML v7 y exportacion a Excel/TSV para monitoreo de proyectos en Microsoft Planner.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 13:44:38 -05:00

30 lines
1,001 B
PowerShell

# Abre el puerto del tablero en el firewall de Windows (ejecutar como Administrador).
param(
[int]$Port = 8765
)
$ruleName = "Tablero Planner SAPIAN ($Port)"
$existing = Get-NetFirewallRule -DisplayName $ruleName -ErrorAction SilentlyContinue
if ($existing) {
Write-Host "[OK] La regla de firewall ya existe: $ruleName"
exit 0
}
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "[ERROR] Ejecuta PowerShell como Administrador."
Write-Host " Clic derecho en PowerShell -> Ejecutar como administrador"
exit 1
}
New-NetFirewallRule `
-DisplayName $ruleName `
-Direction Inbound `
-Action Allow `
-Protocol TCP `
-LocalPort $Port `
-Profile Domain, Private | Out-Null
Write-Host "[OK] Puerto TCP $Port abierto para la red local."
Write-Host " Ahora otros PCs pueden abrir http://TU_IP:$Port/ en Chrome."