Update README for device managedBy comparison focus

This commit is contained in:
2026-04-21 21:35:01 +10:00
parent ebabebfbec
commit 2b42fe1540
+50 -37
View File
@@ -1,67 +1,80 @@
# Disco ICT - AD Compare Plugin
A plugin for [Disco ICT](https://github.com/garysharp/Disco) that compares Active Directory user details against Disco's stored records to identify mismatches.
A plugin for [Disco ICT](https://github.com/garysharp/Disco) that compares the **Managed By** field on Active Directory computer objects against the **Assigned User** in Disco, and reports mismatches.
## What It Does
This plugin provides:
For every active device in Disco that has a domain computer account, this plugin:
- **Full Comparison** — Iterates all Disco users and looks them up in AD, comparing core fields
- **Mismatch Detection** — Identifies differences in Display Name, Surname, Given Name, Email, and Phone Number
- **AD Status Checks** — Flags users not found in AD or with disabled AD accounts
- **Web Dashboard** — In-app UI with filtering, searching, and summary stats
- **CSV Export** — Download comparison results for reporting
- **Detail Provider** — Stores comparison metadata as UserDetails for other plugins to consume
- **Photo Sync** — Pulls `thumbnailPhoto` from AD for user photos
1. Looks up the computer in AD and reads the `managedBy` attribute
2. Resolves the `managedBy` Distinguished Name back to a `DOMAIN\username`
3. Compares that against Disco's `AssignedUserId` for the device
4. Reports mismatches with clear reasons
## Fields Compared
### Mismatch Categories
| Disco Field | AD Attribute |
|-----------------|--------------------|
| DisplayName | displayName |
| Surname | sn |
| GivenName | givenName |
| EmailAddress | mail |
| PhoneNumber | telephoneNumber |
- **Different users** — Disco has one user assigned, AD `managedBy` points to someone else
- **Assigned in Disco but AD empty** — Device is assigned in Disco but `managedBy` is blank in AD
- **Not assigned in Disco but AD set** — No Disco assignment but `managedBy` is populated
- **Computer not found in AD** — The device's domain ID doesn't resolve to an AD computer object
## Web Dashboard
The plugin provides an in-app dashboard accessible via the Disco plugin web handler:
- Summary stats with colour-coded counts
- Filterable results table (mismatches only by default)
- Text search across serial numbers, computer names, and user IDs
- CSV export of all mismatches
## Project Structure
```
Disco.Plugins.ADCompare/
├── ADComparePlugin.cs # Main plugin class
├── ConfigurationHandler/
│ └── ADCompareConfigurationHandler.cs # Required config handler + Razor view
├── Features/
── ADCompareDetailsProvider.cs # DetailsProviderFeature implementation
│ └── ADCompareService.cs # Core comparison logic
── DeviceCompareService.cs # Core comparison logic
├── Models/
│ └── UserComparisonResult.cs # Comparison result models
│ └── DeviceComparisonResult.cs # Result models
├── WebHandler/
│ └── ADCompareWebHandler.cs # Web UI and API endpoints
│ └── ADCompareWebHandler.cs # Dashboard, JSON API, CSV export
├── Properties/
│ └── AssemblyInfo.cs
├── Build-Plugin.ps1 # Build + package script
├── Disco.Plugins.ADCompare.csproj
└── README.md
```
## Web Handler Endpoints
## Building & Packaging
| Action | Description |
|----------------|-------------------------------------------------|
| `Index` | Dashboard page with comparison UI |
| `Compare` | Runs full comparison, returns JSON |
| `CompareUser` | Compare single user (`?userId=DOMAIN\username`) |
| `Export` | Download results as CSV |
### Prerequisites
## Building
- Windows machine with Visual Studio or MSBuild
- The Disco ICT solution cloned and built
This plugin needs to reference the Disco ICT assemblies (`Disco.Models.dll`, `Disco.Data.dll`, `Disco.Services.dll`). Adjust the HintPaths in the `.csproj` to point at your local Disco build output, or add as ProjectReferences if building within the Disco solution.
### Steps
## Installation
1. Clone this repo alongside (or inside) the Disco solution directory
2. Build the Disco solution first (so assemblies are available)
3. Run the build script:
1. Build the project to produce `Disco.Plugins.ADCompare.dll`
2. Place the DLL in the Disco plugins directory
3. Restart Disco ICT
4. Navigate to the plugin configuration in Disco's admin panel
5. Click "Run Full Comparison" to see results
```powershell
.\Build-Plugin.ps1 -DiscoSolutionPath "C:\Path\To\Disco"
```
This will:
- Compile the plugin against Disco's assemblies
- Generate a `manifest.json` (using Disco's ManifestGenerator if available, or manually)
- Package everything into a `.discoPlugin` file (which is just a zip)
### Installing
1. In Disco ICT, go to **Configuration > Plugins**
2. Click **Install Plugin**
3. Upload the `.discoPlugin` file
4. Restart Disco
5. Navigate to the plugin dashboard to run comparisons
## Requirements