# zabero/profilejanitor architecture

> Architecture diagram of the GitHub repository zabero/profilejanitor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zabero/profilejanitor
- Repository: https://github.com/zabero/profilejanitor

## Overview

ProfileJanitor is an administrator-facing Windows utility for inspecting and safely removing unused, orphaned, or leftover user profiles, locally or remotely. The main workflow is to load and classify profiles, choose candidates, optionally create a ZIP backup, then delete and report the result. It supports both a WPF interface and command-line operation, plus exclusions and event-log auditing. The excerpts show application startup, deletion safeguards, and core access helpers; some inventory and CLI dispatch details are documented but not shown in full.

Main entry points: [`Core.cs`](https://github.com/zabero/profilejanitor/blob/main/Core.cs) (Safe deletion), [`MainWindow.xaml.cs`](https://github.com/zabero/profilejanitor/blob/main/MainWindow.xaml.cs) (Profile window), [`App.xaml.cs`](https://github.com/zabero/profilejanitor/blob/main/App.xaml.cs) (Application startup), [`Help.cs`](https://github.com/zabero/profilejanitor/blob/main/Help.cs) (Built-in help)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_app["Application startup<br/>[App.xaml.cs]"]
  node_cli["Command-line mode<br/>[Core.cs]"]
end

subgraph group_interaction["Operator experience"]
  node_window["Profile window<br/>[MainWindow.xaml.cs]"]
  node_help["Built-in help<br/>[Help.cs]"]
  node_selection["Candidate selection<br/>[MainWindow.xaml.cs]"]
end

subgraph group_profile_ops["Profile operations"]
  node_inventory["Profile inventory<br/>[Core.cs]"]
  node_classification["Profile classification<br/>[Core.cs]"]
  node_deletion["Safe deletion<br/>[Core.cs]"]
  node_zip_backup["ZIP backup<br/>[Core.cs]"]
end

subgraph group_state_access["State and access"]
  node_exclusions["Permanent exclusions<br/>[Core.cs]"]
  node_target_access["Target access<br/>[Core.cs]"]
  node_windows_state[("Windows profile state")]
  node_event_log[("Windows event log")]
end

node_administrator(("Administrator"))
node_remote_computer["Remote computer"]

node_administrator -->|"starts"| node_app
node_app -->|"opens"| node_window
node_app -->|"dispatches"| node_cli
node_window -->|"opens"| node_help
node_window -->|"requests listing"| node_inventory
node_inventory -->|"classifies profiles"| node_classification
node_window -->|"selects candidates"| node_selection
node_selection -->|"requests removal"| node_deletion
node_cli -.->|"lists profiles"| node_inventory
node_cli -.->|"requests removal"| node_deletion
node_deletion -->|"backs up first"| node_zip_backup
node_deletion -->|"checks exclusions"| node_exclusions
node_deletion -->|"uses target"| node_target_access
node_inventory -.->|"reads profile data"| node_target_access
node_target_access -->|"accesses registry and WMI"| node_windows_state
node_target_access -->|"connects remotely"| node_remote_computer
node_deletion -->|"records result"| node_event_log

click node_app "https://github.com/zabero/profilejanitor/blob/main/App.xaml.cs"
click node_window "https://github.com/zabero/profilejanitor/blob/main/MainWindow.xaml.cs"
click node_help "https://github.com/zabero/profilejanitor/blob/main/Help.cs"
click node_cli "https://github.com/zabero/profilejanitor/blob/main/Core.cs"
click node_inventory "https://github.com/zabero/profilejanitor/blob/main/Core.cs"
click node_classification "https://github.com/zabero/profilejanitor/blob/main/Core.cs"
click node_selection "https://github.com/zabero/profilejanitor/blob/main/MainWindow.xaml.cs"
click node_deletion "https://github.com/zabero/profilejanitor/blob/main/Core.cs"
click node_zip_backup "https://github.com/zabero/profilejanitor/blob/main/Core.cs"
click node_exclusions "https://github.com/zabero/profilejanitor/blob/main/Core.cs"
click node_target_access "https://github.com/zabero/profilejanitor/blob/main/Core.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_cli toneBlue
class node_window,node_help,node_selection toneAmber
class node_inventory,node_classification,node_deletion,node_zip_backup toneMint
class node_exclusions,node_target_access,node_windows_state,node_event_log toneRose
class node_administrator,node_remote_computer toneIndigo
```

## Components

### Application entry

- [Application startup](https://github.com/zabero/profilejanitor/blob/main/App.xaml.cs): `App.xaml.cs`
- [Command-line mode](https://github.com/zabero/profilejanitor/blob/main/Core.cs): `Core.cs`

### Operator experience

- [Profile window](https://github.com/zabero/profilejanitor/blob/main/MainWindow.xaml.cs): `MainWindow.xaml.cs`
- [Built-in help](https://github.com/zabero/profilejanitor/blob/main/Help.cs): `Help.cs`
- [Candidate selection](https://github.com/zabero/profilejanitor/blob/main/MainWindow.xaml.cs): `MainWindow.xaml.cs`

### Profile operations

- [Profile inventory](https://github.com/zabero/profilejanitor/blob/main/Core.cs): `Core.cs`
- [Profile classification](https://github.com/zabero/profilejanitor/blob/main/Core.cs): `Core.cs`
- [Safe deletion](https://github.com/zabero/profilejanitor/blob/main/Core.cs): `Core.cs`
- [ZIP backup](https://github.com/zabero/profilejanitor/blob/main/Core.cs): `Core.cs`

### State and access

- [Permanent exclusions](https://github.com/zabero/profilejanitor/blob/main/Core.cs): `Core.cs`
- [Target access](https://github.com/zabero/profilejanitor/blob/main/Core.cs): `Core.cs`
- **Windows profile state**
- **Windows event log**

### Other components

- **Administrator**
- **Remote computer**

## Connections

- Administrator → Application startup: starts (evidence: `README.md`)
- Application startup → Profile window: opens (evidence: `App.xaml.cs`)
- Application startup → Command-line mode: dispatches (evidence: `App.xaml.cs`)
- Profile window → Built-in help: opens (evidence: `MainWindow.xaml.cs`)
- Profile window → Profile inventory: requests listing (evidence: `README.md`)
- Profile inventory → Profile classification: classifies profiles (evidence: `README.md`)
- Profile window → Candidate selection: selects candidates (evidence: `README.md`)
- Candidate selection → Safe deletion: requests removal (evidence: `README.md`)
- Command-line mode → Profile inventory: lists profiles (evidence: `Core.cs`)
- Command-line mode → Safe deletion: requests removal (evidence: `Core.cs`)
- Safe deletion → ZIP backup: backs up first (evidence: `Core.cs`)
- Safe deletion → Permanent exclusions: checks exclusions (evidence: `Core.cs`)
- Safe deletion → Target access: uses target (evidence: `Core.cs`)
- Profile inventory → Target access: reads profile data (evidence: `Core.cs`)
- Target access → Windows profile state: accesses registry and WMI (evidence: `Core.cs`)
- Target access → Remote computer: connects remotely (evidence: `README.md`)
- Safe deletion → Windows event log: records result (evidence: `Core.cs`)
