# Disco ICT - AD Compare Plugin 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 For every active device in Disco that has a domain computer account, this plugin: 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 ### Mismatch Categories - **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 ``` ├── ADComparePlugin.cs # Main plugin class ├── ConfigurationHandler/ │ └── ADCompareConfigurationHandler.cs # Required config handler + Razor view ├── Features/ │ └── DeviceCompareService.cs # Core comparison logic ├── Models/ │ └── DeviceComparisonResult.cs # Result models ├── WebHandler/ │ └── ADCompareWebHandler.cs # Dashboard, JSON API, CSV export ├── Properties/ │ └── AssemblyInfo.cs ├── Build-Plugin.ps1 # Build + package script ├── Disco.Plugins.ADCompare.csproj └── README.md ``` ## Building & Packaging ### Prerequisites - Windows machine with Visual Studio or MSBuild - The Disco ICT solution cloned and built ### Steps 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: ```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 - Disco ICT (compatible version) - .NET Framework 4.7.2 - Active Directory connectivity from the Disco server