fix: init NotifyDedupCache under StrictMode (1.2.24-SAC)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-30 10:26:07 +10:00
parent 724baa6c0a
commit 1ff8dd1a95
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -80,7 +80,7 @@ $script:MonitorLoopInitialized = $false
# строки ниже, если правки «мелкие» и вы не хотите менять отображаемую версию в логах).
# Рекомендация: при значимых релизах меняйте и $ScriptVersion, и version.txt одинаково; при только
# исправлениях на шаре — достаточно поднять patch в version.txt (например 1.3.0.1).
$ScriptVersion = "1.2.23-SAC"
$ScriptVersion = "1.2.24-SAC"
# Логи (все под InstallRoot)
$LogFile = Join-Path $script:InstallRoot "Logs\login_monitor.log"
@@ -102,6 +102,7 @@ $DeployUpdateMarkerFile = Join-Path $script:InstallRoot "deploy_last_update.txt"
$script:IgnoreListPath = Join-Path $script:InstallRoot "ignore.lst"
$script:IgnoreListCache = $null
$script:IgnoreListCacheStampUtc = $null
$script:NotifyDedupCache = @{}
# Ежедневный отчет
$DailyReportHour = 9
@@ -1477,7 +1478,7 @@ function Test-RdpMonitorNotifyDedup {
[int]$WindowSeconds = 90
)
if ([string]::IsNullOrWhiteSpace($Key)) { return $false }
if (-not $script:NotifyDedupCache) {
if (-not (Get-Variable -Scope Script -Name NotifyDedupCache -ErrorAction SilentlyContinue)) {
$script:NotifyDedupCache = @{}
}
$now = Get-Date
@@ -3051,7 +3052,6 @@ function Start-LoginMonitor {
$lastRcmShadowCheckTime = (Get-Date).AddSeconds(-10)
$lastWinRmCheckTime = (Get-Date).AddSeconds(-10)
$lastLockout4740CheckTime = (Get-Date).AddSeconds(-10)
if (-not $script:NotifyDedupCache) { $script:NotifyDedupCache = @{} }
$monitorEvents = @(4624, 4625, 4648)
while ($true) {