sync: auto-sync from HOWARD-HOME at 2026-07-07 13:55:03
Author: Howard Enos Machine: HOWARD-HOME Timestamp: 2026-07-07 13:55:03
This commit is contained in:
6
.claude/scripts/edr-isolation-watch-hidden.vbs
Normal file
6
.claude/scripts/edr-isolation-watch-hidden.vbs
Normal file
@@ -0,0 +1,6 @@
|
||||
' edr-isolation-watch-hidden.vbs — launch the EDR isolation watcher with no visible window.
|
||||
' Run via the "ClaudeTools - EDR Isolation Watcher" scheduled task through wscript.exe (a GUI
|
||||
' host, no console), which starts bash with window style 0 (hidden) so the every-10-min watch
|
||||
' no longer flashes a console window on the desktop. Runtime env is identical to a direct bash
|
||||
' launch. Mirrors gps-rmm-progress-hidden.vbs.
|
||||
CreateObject("WScript.Shell").Run """C:\Program Files\Git\bin\bash.exe"" -lc ""/c/claudetools/.claude/scripts/edr-isolation-watch.sh""", 0, False
|
||||
@@ -13,15 +13,21 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
$TaskName = "ClaudeTools - EDR Isolation Watcher"
|
||||
|
||||
# Bash launcher (mirrors the GPS-RMM-AutoEnroll task action)
|
||||
# Launch via a wscript.exe VBS wrapper (GUI-subsystem host) so bash starts hidden and
|
||||
# NO console window flashes on the desktop every 10 min. Launching bash.exe directly is
|
||||
# a console-subsystem app with LogonType=Interactive + Hidden=False -> visible flash.
|
||||
# Mirrors the gps-rmm-progress-hidden.vbs fix. Do NOT revert to a raw bash.exe action.
|
||||
$BashExe = "C:\Program Files\Git\bin\bash.exe"
|
||||
if (-not (Test-Path $BashExe)) { Write-Host "[ERROR] Git bash not found at $BashExe" -ForegroundColor Red; exit 1 }
|
||||
|
||||
$ScriptPosix = "/c/claudetools/.claude/scripts/edr-isolation-watch.sh"
|
||||
$ScriptWin = "C:\claudetools\.claude\scripts\edr-isolation-watch.sh"
|
||||
$ScriptWin = "C:\claudetools\.claude\scripts\edr-isolation-watch.sh"
|
||||
if (-not (Test-Path $ScriptWin)) { Write-Host "[ERROR] Watcher not found at $ScriptWin" -ForegroundColor Red; exit 1 }
|
||||
|
||||
$Action = New-ScheduledTaskAction -Execute $BashExe -Argument "-lc $ScriptPosix"
|
||||
$WScript = "C:\Windows\System32\wscript.exe"
|
||||
$Vbs = "C:\claudetools\.claude\scripts\edr-isolation-watch-hidden.vbs"
|
||||
if (-not (Test-Path $Vbs)) { Write-Host "[ERROR] Hidden wrapper not found at $Vbs" -ForegroundColor Red; exit 1 }
|
||||
|
||||
$Action = New-ScheduledTaskAction -Execute $WScript -Argument "`"$Vbs`""
|
||||
|
||||
# Every 10 minutes, indefinitely (10-year duration avoids the MaxValue quirk).
|
||||
$Trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).Date `
|
||||
@@ -35,7 +41,7 @@ $Principal = New-ScheduledTaskPrincipal -UserId "$env:USERDOMAIN\$env:USERNAME"
|
||||
$Settings = New-ScheduledTaskSettingsSet `
|
||||
-AllowStartIfOnBatteries -DontStopIfGoingOnBatteries `
|
||||
-StartWhenAvailable -ExecutionTimeLimit (New-TimeSpan -Minutes 5) `
|
||||
-MultipleInstances IgnoreNew
|
||||
-MultipleInstances IgnoreNew -Hidden
|
||||
|
||||
Register-ScheduledTask -TaskName $TaskName -Action $Action -Trigger $Trigger `
|
||||
-Principal $Principal -Settings $Settings `
|
||||
|
||||
@@ -47,14 +47,26 @@ if (-not (Test-Path $Script)) {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Resolve the py launcher's full path (the action's Execute wants an absolute
|
||||
# path; "py" alone usually resolves but we pin it for reliability under the
|
||||
# Task Scheduler's environment).
|
||||
$PyCmd = Get-Command py -ErrorAction SilentlyContinue
|
||||
# Resolve pythonW.exe (the GUI-subsystem Python host) so the detector runs with NO
|
||||
# console window flashing on the desktop at logon / every 4h. Using py.exe or
|
||||
# python.exe (console subsystem) draws a visible window each run. Prefer pythonw next
|
||||
# to the active interpreter; fall back to a PATH lookup, then py.exe as a last resort.
|
||||
$PyPath = $null
|
||||
$PyCmd = Get-Command py -ErrorAction SilentlyContinue
|
||||
if ($null -ne $PyCmd) {
|
||||
$PyPath = $PyCmd.Source
|
||||
} else {
|
||||
$PyPath = "py" # fall back to PATH resolution at run time
|
||||
try {
|
||||
$exe = (& py -c "import sys;print(sys.executable)").Trim()
|
||||
$wexe = Join-Path (Split-Path $exe) "pythonw.exe"
|
||||
if (Test-Path $wexe) { $PyPath = $wexe }
|
||||
} catch { }
|
||||
}
|
||||
if ($null -eq $PyPath) {
|
||||
$PwCmd = Get-Command pythonw -ErrorAction SilentlyContinue
|
||||
if ($null -ne $PwCmd) { $PyPath = $PwCmd.Source }
|
||||
}
|
||||
if ($null -eq $PyPath) {
|
||||
if ($null -ne $PyCmd) { $PyPath = $PyCmd.Source } else { $PyPath = "py" }
|
||||
Write-Host "[WARNING] pythonw.exe not found; task may flash a console window." -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
$Action = New-ScheduledTaskAction `
|
||||
@@ -76,7 +88,8 @@ $Settings = New-ScheduledTaskSettingsSet `
|
||||
-ExecutionTimeLimit (New-TimeSpan -Minutes 30) `
|
||||
-MultipleInstances IgnoreNew `
|
||||
-StartWhenAvailable `
|
||||
-DontStopOnIdleEnd
|
||||
-DontStopOnIdleEnd `
|
||||
-Hidden
|
||||
|
||||
Register-ScheduledTask `
|
||||
-TaskName $TaskName `
|
||||
|
||||
Reference in New Issue
Block a user