Files
IT_Tool/dev-stop.ps1
Claude Agent 4c40e88718 feat: Phase 8 — Network Discovery + Windows Dev-Setup-Skripte
Network Discovery:
- Go Agent: internal/scanner/scanner.go mit TCP-Sweep (Port 445/80/22/443),
  ARP-Tabellen-Parser (Windows: arp -a, Linux: /proc/net/arp), Reverse-DNS,
  50 gleichzeitige Goroutines mit Semaphore
- Go Agent main.go: COMMAND_TYPE_NETWORK_SCAN Case → scanner.Scan() → JSON stdout
- Backend: NetworkDevice Model (Id, AgentId, IpAddress, MacAddress, Hostname,
  Vendor, IsManaged, FirstSeen, LastSeen)
- Backend: EF Migration AddNetworkDevices + Index auf IpAddress + MacAddress
- Backend: NetworkDevicesController GET /api/v1/network-devices + DELETE /{id}
- Backend: AgentGrpcService.ProcessNetworkScanResultAsync — upsert via MAC,
  IsManaged=true wenn IP einem bekannten Agent entspricht
- Frontend: NetworkPage.tsx mit Scan-Panel, Device-Tabelle, Filter, Delete
- Frontend: App.tsx — 'Netzwerk' Nav-Eintrag mit Network Icon

Windows Dev-Setup:
- dev-start.ps1 — Startet Docker/Postgres, EF-Migrationen, Backend+Frontend
  in separaten PowerShell-Fenstern; Voraussetzungen-Check (docker/dotnet/node/go)
- dev-stop.ps1 — Stoppt alle NexusRMM-Prozesse + PostgreSQL Container
- build-agent.ps1 — Baut nexus-agent.exe (Windows) + optional nexus-agent-linux

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 14:53:35 +01:00

96 lines
3.7 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#Requires -Version 5.1
<#
.SYNOPSIS
Stoppt die NexusRMM Entwicklungsumgebung
.DESCRIPTION
Beendet alle PowerShell-Fenster mit "NexusRMM" im Titel und
fährt den PostgreSQL-Container herunter (ohne Volumes zu löschen).
MeshCentral wird NICHT gestoppt.
#>
$ErrorActionPreference = "Stop"
$Root = "D:\001_Projekte\IT_Tool"
# ---------------------------------------------------------------------------
# Helper
# ---------------------------------------------------------------------------
function Write-Step { param($msg) Write-Host "`n==> $msg" -ForegroundColor Cyan }
function Write-OK { param($msg) Write-Host " [OK] $msg" -ForegroundColor Green }
function Write-Warn { param($msg) Write-Host " [!] $msg" -ForegroundColor Yellow }
function Write-Fail { param($msg) Write-Host " [FEHLER] $msg" -ForegroundColor Red }
# ---------------------------------------------------------------------------
# 1. PowerShell-Fenster mit "NexusRMM" im Hauptfenstertitel schließen
# ---------------------------------------------------------------------------
Write-Step "Schliesse NexusRMM PowerShell-Fenster..."
Add-Type -AssemblyName System.Diagnostics.Process -ErrorAction SilentlyContinue
$currentPid = $PID
$killed = 0
# GetProcesses liefert alle powershell / pwsh Instanzen
$psProcesses = Get-Process -Name @("powershell", "pwsh") -ErrorAction SilentlyContinue
foreach ($proc in $psProcesses) {
if ($proc.Id -eq $currentPid) { continue } # dieses Skript selbst nicht beenden
# Fenstertitel auslesen (MainWindowTitle ist leer bei verborgenen Fenstern)
$title = $proc.MainWindowTitle
if ($title -match "NexusRMM") {
try {
$proc | Stop-Process -Force
Write-OK "Prozess beendet: PID $($proc.Id) '$title'"
$killed++
} catch {
Write-Warn "Konnte Prozess PID $($proc.Id) nicht beenden: $_"
}
}
}
if ($killed -eq 0) {
Write-Warn "Keine laufenden NexusRMM-Fenster gefunden."
} else {
Write-OK "$killed Fenster geschlossen."
}
# ---------------------------------------------------------------------------
# 2. PostgreSQL-Container stoppen (ohne Volume zu entfernen)
# ---------------------------------------------------------------------------
Write-Step "Stoppe PostgreSQL-Container..."
# Prüfen ob Docker läuft
$dockerCmd = Get-Command docker -ErrorAction SilentlyContinue
if ($null -eq $dockerCmd) {
Write-Warn "Docker nicht gefunden überspringe Container-Stop."
} else {
Push-Location $Root
try {
# Nur nexusrmm-postgres stoppen, MeshCentral bleibt unberührt
$containerRunning = docker ps --filter "name=nexusrmm-postgres" --format "{{.Names}}" 2>$null
if ($containerRunning -match "nexusrmm-postgres") {
docker compose stop nexusrmm-postgres
if ($LASTEXITCODE -eq 0) {
Write-OK "nexusrmm-postgres gestoppt."
} else {
Write-Fail "docker compose stop fehlgeschlagen."
}
} else {
Write-Warn "nexusrmm-postgres läuft nicht (bereits gestoppt)."
}
} finally {
Pop-Location
}
}
# ---------------------------------------------------------------------------
# 3. Zusammenfassung
# ---------------------------------------------------------------------------
Write-Host ""
Write-Host "NexusRMM Entwicklungsumgebung gestoppt." -ForegroundColor Green
Write-Host "Volumes wurden behalten (Datenbankdaten bleiben erhalten)." -ForegroundColor Yellow
Write-Host "MeshCentral wurde nicht gestoppt." -ForegroundColor Yellow
Write-Host ""
Write-Host "Neu starten: .\dev-start.ps1" -ForegroundColor Cyan
Write-Host "Alles inkl. Volumes loeschen: docker compose down -v" -ForegroundColor Cyan