feat: SAC agent command poll qwinsta/logoff (2.0.39-SAC)
Poll GET /api/v1/agent/commands every SacCommandPollIntervalSec; execute qwinsta/logoff with run_as from SAC; POST result.
This commit is contained in:
+7
-2
@@ -90,7 +90,7 @@ $script:SkipLogDetailLimit = 15
|
||||
# строки ниже, если правки «мелкие» и вы не хотите менять отображаемую версию в логах).
|
||||
# Рекомендация: при значимых релизах меняйте и $ScriptVersion, и version.txt одинаково; при только
|
||||
# исправлениях на шаре — достаточно поднять patch в version.txt (например 1.3.0.1).
|
||||
$ScriptVersion = "2.0.38-SAC"
|
||||
$ScriptVersion = "2.0.39-SAC"
|
||||
|
||||
# Логи (все под InstallRoot)
|
||||
$LogFile = Join-Path $script:InstallRoot "Logs\login_monitor.log"
|
||||
@@ -108,7 +108,7 @@ $StartupRebootDetectMinutes = 5
|
||||
# Инвентаризация железа/ПО для SAC (agent.inventory); интервал опроса, сек (12 ч).
|
||||
$InventoryIntervalSec = 43200
|
||||
$GetInventory = 1
|
||||
$HeartbeatStaleAlertMultiplier = 2
|
||||
$SacCommandPollIntervalSec = 60
|
||||
# Один RDP-вход часто даёт 2+ события 4624 с одним временем — не слать дубли в Telegram/SAC.
|
||||
$LoginSuccessNotifyDedupSeconds = 90
|
||||
$HeartbeatFile = Join-Path $script:InstallRoot "Logs\last_heartbeat.txt"
|
||||
@@ -4404,6 +4404,7 @@ function Start-LoginMonitor {
|
||||
$adminShareMonitoringEnabled = Test-MonitorFeatureEnabled -Value $EnableAdminShareMonitoring
|
||||
|
||||
$nextHeartbeatTime = (Get-Date).AddSeconds($HeartbeatInterval)
|
||||
$script:NextSacCommandPollTime = Get-Date
|
||||
$nextInventoryTime = (Get-Date).AddSeconds($InventoryIntervalSec)
|
||||
$nextRotationCheck = Check-AndRotateLog
|
||||
$nextReportCheck = Check-AndSendDailyReport
|
||||
@@ -4934,6 +4935,10 @@ function Start-LoginMonitor {
|
||||
}
|
||||
if ($script:SacClientLoaded) {
|
||||
Invoke-SacFlushSpool -MaxFiles 5 | Out-Null
|
||||
if ((Get-SacNormalizedMode) -ne 'off' -and $now -ge $script:NextSacCommandPollTime) {
|
||||
Invoke-SacProcessPendingCommands | Out-Null
|
||||
$script:NextSacCommandPollTime = $now.AddSeconds($SacCommandPollIntervalSec)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
if ($_.Exception -is [System.Management.Automation.PipelineStoppedException]) { throw }
|
||||
|
||||
Reference in New Issue
Block a user