12 lines
1003 B
PowerShell
12 lines
1003 B
PowerShell
# vd03 AdminUI is plain HTTP: the Secure-only auth cookie never comes back, so login loops. Match HG/mxgw/ScadaBridge on vd03.
|
|
$ErrorActionPreference = 'Stop'
|
|
$k = 'HKLM:\SYSTEM\CurrentControlSet\Services\OtOpcUaHost'
|
|
$before = @((Get-ItemProperty $k).Environment)
|
|
if (@($before | Where-Object { $_ -like 'Security__Cookie__RequireHttpsCookie=*' }).Count) { throw 'already set' }
|
|
Set-ItemProperty -Path $k -Name Environment -Value ([string[]]($before + 'Security__Cookie__RequireHttpsCookie=false')) -Type MultiString
|
|
"env entries $($before.Count) -> $(@((Get-ItemProperty $k).Environment).Count)"
|
|
"restarting $(Get-Date -Format HH:mm:ss)"; Restart-Service OtOpcUaHost -Force
|
|
$deadline = (Get-Date).AddSeconds(240); $ok = $false
|
|
while ((Get-Date) -lt $deadline) { try { if ((Invoke-WebRequest -UseBasicParsing 'http://127.0.0.1:9000/health/ready' -TimeoutSec 5).StatusCode -eq 200) { $ok = $true; break } } catch {}; Start-Sleep 2 }
|
|
"ready=$ok at $(Get-Date -Format HH:mm:ss)"; if (-not $ok) { exit 1 }
|