Files
Netbox-Client-Agent-for-Win…/scripts/uninstall.ps1
T
MrBlakeandClaude Opus 5.5 0098b49787
Build Windows agent / build (win-arm64) (push) Canceled after 0s
Build Windows agent / build (win-x64) (push) Canceled after 0s
feat: listen mode for scanning by the NetBox Synchronizer, Intune and GPO deployment
- New "mode" setting: "netbox" (default, unchanged), "listen" (no NetBox access needed; the
  inventory is served on a TCP port for the NetBox Synchronizer desktop app) or "both"
- Listen protocol v1: HMAC-SHA256 signed requests with nonce and timestamp, AES-256-GCM encrypted
  inventory, optional allowed_networks; the inventory has the shape of the desktop app's WinRM scan
- New options --serve, --print and --version
- install.ps1 sets up the listener task (at startup, restarted on failure) and the firewall rule for
  listen mode, removes what a changed mode no longer needs and stays idempotent
- New gpo-startup.ps1 for Group Policy startup scripts: installs or updates from a share only when
  agent.exe or config.json changed
- README, messages and scripts in English

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 11:01:46 +01:00

17 lines
1.1 KiB
PowerShell

param([string]$InstallDirectory = "$env:ProgramFiles\NetBox Windows Agent")
$ErrorActionPreference = 'Stop'
Unregister-ScheduledTask -TaskName 'NetBox Windows Agent' -Confirm:$false -ErrorAction SilentlyContinue
Stop-ScheduledTask -TaskName 'NetBox Windows Agent Listener' -ErrorAction SilentlyContinue
Unregister-ScheduledTask -TaskName 'NetBox Windows Agent Listener' -Confirm:$false -ErrorAction SilentlyContinue
Remove-NetFirewallRule -Name 'NetBoxWindowsAgent' -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 "Unsafe target: $resolved" }
Get-Process -Name agent -ErrorAction SilentlyContinue |
Where-Object { $_.Path -and $_.Path.StartsWith($resolved, [StringComparison]::OrdinalIgnoreCase) } |
Stop-Process -Force -ErrorAction SilentlyContinue
Start-Sleep -Milliseconds 500
Remove-Item -LiteralPath $resolved -Recurse -Force
}