lightman-agent 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/install-windows.ps1 +31 -2
package/package.json
CHANGED
|
@@ -48,7 +48,30 @@ function Get-LightmanNodeProcesses {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
function Get-InstallerParentNodePid {
|
|
52
|
+
try {
|
|
53
|
+
$self = Get-CimInstance Win32_Process -Filter "ProcessId=$PID" -ErrorAction SilentlyContinue
|
|
54
|
+
if (-not $self) { return $null }
|
|
55
|
+
|
|
56
|
+
$parentPid = $self.ParentProcessId
|
|
57
|
+
if (-not $parentPid) { return $null }
|
|
58
|
+
|
|
59
|
+
$parent = Get-CimInstance Win32_Process -Filter "ProcessId=$parentPid" -ErrorAction SilentlyContinue
|
|
60
|
+
if ($parent -and $parent.Name -eq "node.exe") {
|
|
61
|
+
return [int]$parent.ProcessId
|
|
62
|
+
}
|
|
63
|
+
} catch {
|
|
64
|
+
return $null
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return $null
|
|
68
|
+
}
|
|
69
|
+
|
|
51
70
|
function Stop-LightmanNodeProcesses {
|
|
71
|
+
param(
|
|
72
|
+
[int]$ExcludePid = 0
|
|
73
|
+
)
|
|
74
|
+
|
|
52
75
|
$procs = Get-LightmanNodeProcesses
|
|
53
76
|
if (-not $procs -or $procs.Count -eq 0) {
|
|
54
77
|
Write-Host " No LIGHTMAN-owned node.exe processes found" -ForegroundColor DarkGray
|
|
@@ -56,6 +79,11 @@ function Stop-LightmanNodeProcesses {
|
|
|
56
79
|
}
|
|
57
80
|
|
|
58
81
|
foreach ($proc in $procs) {
|
|
82
|
+
if ($ExcludePid -gt 0 -and $proc.ProcessId -eq $ExcludePid) {
|
|
83
|
+
Write-Host " Keeping installer parent node.exe PID $($proc.ProcessId)" -ForegroundColor DarkGray
|
|
84
|
+
continue
|
|
85
|
+
}
|
|
86
|
+
|
|
59
87
|
try {
|
|
60
88
|
Stop-Process -Id $proc.ProcessId -Force -ErrorAction Stop
|
|
61
89
|
Write-Host " Stopped LIGHTMAN node.exe PID $($proc.ProcessId)" -ForegroundColor DarkGray
|
|
@@ -130,10 +158,11 @@ foreach ($tn in @($AgentTask, $KioskTask, $GuardianTask)) {
|
|
|
130
158
|
$t = Get-ScheduledTask -TaskName $tn -ErrorAction SilentlyContinue
|
|
131
159
|
if ($t) { Stop-ScheduledTask -TaskName $tn -ErrorAction SilentlyContinue; Unregister-ScheduledTask -TaskName $tn -Confirm:$false -ErrorAction SilentlyContinue }
|
|
132
160
|
}
|
|
133
|
-
|
|
161
|
+
|
|
134
162
|
# Kill only LIGHTMAN-owned processes
|
|
135
163
|
Write-Host "[0c] Stopping LIGHTMAN node/chrome processes only..." -ForegroundColor Yellow
|
|
136
|
-
|
|
164
|
+
$installerParentNodePid = Get-InstallerParentNodePid
|
|
165
|
+
Stop-LightmanNodeProcesses -ExcludePid $installerParentNodePid
|
|
137
166
|
Stop-LightmanChromeProcesses
|
|
138
167
|
Start-Sleep -Seconds 2
|
|
139
168
|
|