fix: use native scheduled task cmdlets and improve error diagnostics
Build Windows agent / build (win-arm64) (push) Has been cancelled
Build Windows agent / build (win-x64) (push) Has been cancelled

This commit is contained in:
2026-07-21 13:43:25 +02:00
parent 6989680340
commit 61aa9ad61b
3 changed files with 17 additions and 5 deletions
+1 -2
View File
@@ -1,10 +1,9 @@
param([string]$InstallDirectory = "$env:ProgramFiles\NetBox Windows Agent")
$ErrorActionPreference = 'Stop'
schtasks.exe /Delete /TN 'NetBox Windows Agent' /F 2>$null
Unregister-ScheduledTask -TaskName 'NetBox Windows Agent' -Confirm:$false -ErrorAction SilentlyContinue
if (Test-Path -LiteralPath $InstallDirectory) {
$resolved = (Resolve-Path -LiteralPath $InstallDirectory).Path
$programFiles = (Resolve-Path -LiteralPath $env:ProgramFiles).Path
if (-not $resolved.StartsWith($programFiles + '\', [StringComparison]::OrdinalIgnoreCase)) { throw "Unsicheres Ziel: $resolved" }
Remove-Item -LiteralPath $resolved -Recurse -Force
}