fix: require site and correct Intune installation detection
This commit is contained in:
@@ -30,7 +30,7 @@ Erforderlich:
|
||||
- DCIM Module Types, Module Bays und Modules
|
||||
- Inventory Assets des Plugins
|
||||
|
||||
Site, Location und Device Role legt der Agent absichtlich nicht automatisch an. Hersteller, Device Types und erkannte Hardwaretypen dagegen schon.
|
||||
Site und Device Role legt der Agent absichtlich nicht automatisch an. Eine Site ist für jedes NetBox Device zwingend erforderlich. Location ist optional. Hersteller, Device Types und erkannte Hardwaretypen legt der Agent bei Bedarf an.
|
||||
|
||||
## 2. Repository herunterladen und EXE bauen
|
||||
|
||||
@@ -79,7 +79,7 @@ Minimalbeispiel zum Kopieren:
|
||||
}
|
||||
```
|
||||
|
||||
`site` und `location` dürfen vollständig entfernt oder auf `null` gesetzt werden. `region` grenzt die Suche nach der Site ein.
|
||||
`site` muss den Slug einer vorhandenen NetBox Site enthalten, da NetBox für jedes DCIM Device eine Site verlangt. `location` ist optional und darf entfernt oder auf `null` gesetzt werden. `region` grenzt die Suche nach der Site ein.
|
||||
|
||||
### Selbstsigniertes Zertifikat
|
||||
|
||||
@@ -191,8 +191,11 @@ powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\uninstall.ps1
|
||||
Installationsverhalten:
|
||||
System
|
||||
|
||||
Erkennungsregel:
|
||||
Datei C:\Program Files\NetBox Windows Agent\agent.exe vorhanden
|
||||
Erkennungsregel (Regeltyp „Datei“):
|
||||
Pfad: C:\Program Files\NetBox Windows Agent
|
||||
Datei oder Ordner: agent.exe
|
||||
Erkennungsmethode: Datei oder Ordner ist vorhanden
|
||||
Auf 64-Bit-Clients einer 32-Bit-App zugeordnet: Nein
|
||||
```
|
||||
|
||||
## Fehlerbehebung
|
||||
@@ -221,6 +224,24 @@ Wenn keine eigenen NetBox Custom Fields angelegt wurden:
|
||||
|
||||
Dem Benutzer des API-Tokens fehlen Rechte für den im Fehler genannten Objekttyp.
|
||||
|
||||
### `site: Dieses Feld ist erforderlich`
|
||||
|
||||
NetBox verlangt für jedes DCIM Device eine Site. In `config.json` den Slug einer vorhandenen Site eintragen:
|
||||
|
||||
```json
|
||||
"site": "berlin",
|
||||
"location": null
|
||||
```
|
||||
|
||||
### Intune meldet Installation fehlgeschlagen, die Dateien sind aber vorhanden
|
||||
|
||||
Bei einer Datei-Erkennungsregel darf im Feld `Pfad` nur der Ordner stehen. `agent.exe` gehört ausschließlich in das separate Feld `Datei oder Ordner`:
|
||||
|
||||
```text
|
||||
Pfad: C:\Program Files\NetBox Windows Agent
|
||||
Datei oder Ordner: agent.exe
|
||||
```
|
||||
|
||||
### `400 Bad Request`
|
||||
|
||||
Die vollständige Antwort hinter `FEHLER:` enthält das von NetBox beanstandete Feld. Häufig fehlen die konfigurierte Device Role, Site oder Location.
|
||||
|
||||
+4
-1
@@ -25,4 +25,7 @@ $trigger = New-ScheduledTaskTrigger -Daily -At $StartTime
|
||||
$principal = New-ScheduledTaskPrincipal -UserId 'S-1-5-18' -LogonType ServiceAccount -RunLevel Highest
|
||||
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -ExecutionTimeLimit (New-TimeSpan -Minutes 15)
|
||||
Register-ScheduledTask -TaskName 'NetBox Windows Agent' -Action $action -Trigger $trigger -Principal $principal -Settings $settings -Force | Out-Null
|
||||
& (Join-Path $InstallDirectory 'agent.exe') --config (Join-Path $InstallDirectory 'config.json')
|
||||
& $agentPath --config $configPath
|
||||
if ($LASTEXITCODE -ne 0) { throw "Die erste NetBox-Synchronisation ist mit Exitcode $LASTEXITCODE fehlgeschlagen." }
|
||||
Write-Host 'NetBox Windows Agent wurde erfolgreich installiert und synchronisiert.'
|
||||
exit 0
|
||||
|
||||
@@ -36,6 +36,7 @@ static void Validate(AgentConfig c)
|
||||
if (!Uri.TryCreate(c.NetBoxUrl, UriKind.Absolute, out var uri) || (uri.Scheme != "https" && uri.Scheme != "http")) throw new InvalidOperationException("netbox_url ist ungültig.");
|
||||
if (string.IsNullOrWhiteSpace(c.ApiToken) || c.ApiToken == "CHANGE_ME") throw new InvalidOperationException("api_token fehlt.");
|
||||
if (string.IsNullOrWhiteSpace(c.DeviceRole)) throw new InvalidOperationException("device_role fehlt.");
|
||||
if (string.IsNullOrWhiteSpace(c.Site)) throw new InvalidOperationException("site fehlt. NetBox verlangt für jedes DCIM Device eine Site; nur location ist optional.");
|
||||
if (c.MaxSoftwareEntries < 0 || c.MaxSoftwareEntries > 1000) throw new InvalidOperationException("max_software_entries muss zwischen 0 und 1000 liegen.");
|
||||
}
|
||||
static void Usage() => Console.WriteLine("agent.exe [--config PFAD] [--dry-run] [--help]");
|
||||
|
||||
Reference in New Issue
Block a user