diff --git a/scripts/src/hwlab-hwpod-node.ts b/scripts/src/hwlab-hwpod-node.ts index a4770959..e2303b3c 100644 --- a/scripts/src/hwlab-hwpod-node.ts +++ b/scripts/src/hwlab-hwpod-node.ts @@ -526,7 +526,7 @@ $probe = [string]$payload.probeLauncherPath $launcherArgs = @($payload.launcherArgs | ForEach-Object { [string]$_ }) $versionOut = @(& $probe @launcherArgs -c "import sys;print(sys.version);print(sys.executable)" 2>&1) $versionExit = $LASTEXITCODE -$processes = @(Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -and $_.CommandLine.Contains($scriptPath) }) +$processes = @(Get-CimInstance Win32_Process | Where-Object { $_.Name -like 'python*.exe' -and $_.CommandLine -and $_.CommandLine.Contains($scriptPath) }) $explorerSessions = @(Get-Process explorer -ErrorAction SilentlyContinue | Select-Object -ExpandProperty SessionId -Unique) $interactive = @($processes | Where-Object { $explorerSessions -contains $_.SessionId }) $runValue = (Get-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run' -Name ([string]$payload.runKeyName) -ErrorAction SilentlyContinue).([string]$payload.runKeyName) @@ -594,7 +594,7 @@ $stdoutPath = $logPath + '.stdout' $stderrPath = $logPath + '.stderr' Start-Process -FilePath $gui -ArgumentList @($launcherArgs + @($scriptPath)) -WorkingDirectory $root -RedirectStandardOutput $stdoutPath -RedirectStandardError $stderrPath Start-Sleep -Seconds 3 -$processes = @(Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -and $_.CommandLine.Contains($scriptPath) }) +$processes = @(Get-CimInstance Win32_Process | Where-Object { $_.Name -like 'python*.exe' -and $_.CommandLine -and $_.CommandLine.Contains($scriptPath) }) $explorerSessions = @(Get-Process explorer -ErrorAction SilentlyContinue | Select-Object -ExpandProperty SessionId -Unique) $interactive = @($processes | Where-Object { $explorerSessions -contains $_.SessionId }) $result = [ordered]@{