# friendsofmdt/psd architecture

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

- Interactive diagram: https://gitdiagram.com/friendsofmdt/psd
- Repository: https://github.com/friendsofmdt/psd

## Overview

1. **What this repository is**
   - This is a PowerShell-based extension kit for Microsoft Deployment Toolkit–style operating system deployment.
   - It is not a conventional application repo; it is a bundle of deployment content, scripts, templates, wizard UI, and server-setup helpers that together form a deployment platform.

2. **Primary architectural layers**
   - **Authoring/configuration layer:** INI files, XML definitions, task-sequence templates, and deployment-share metadata.
   - **Runtime deployment layer:** PowerShell scripts executed in WinPE and later in the target OS during imaging.
   - **User interaction layer:** the prestart and wizard UI used to gather deployment choices before task sequence execution.
   - **Infrastructure layer:** IIS/HTTPS, BranchCache/BITS, certificates, and optional REST/web instance support.

3. **Repository bootstrap and install path**
   - `Install-PSD.ps1` is the top-level installer/bootstrap entry point.
   - It appears to lay down the PSD framework, provision folders, and wire the deployment share structure expected by the rest of the toolkit.
   - The repo’s `Tools/` scripts support server-side setup and instance configuration around that bootstrap.

4. **Deployment execution flow**
   - The runtime flow is centered in `Scripts/PSDStart.ps1`, `Scripts/PSDPrestart.ps1`, and the `ZTI*.xml`/`PSD*.ps1` scripts.
   - The process typically begins in prestart, collects environment and user choices, then transitions into gathering, validation, partitioning, application/driver selection, OS application, and finalization.
   - This is a staged pipeline rather than a single monolithic installer.

5. **Core task-sequence style subsystems**
   - `PSDGather`, `PSDValidate`, `PSDPartition`, `PSDDrivers`, `PSDApplications`, `PSDApplyOS`, `PSDFinal`, and related scripts map to major deployment phases.
   - `PSDConfigure`, `PSDSetVariable`, `PSDUpdateDisk`, `PSDTattoo`, and `PSDWindowsUpdate` handle configuration, state application, disk prep, and post-deploy maintenance.
   - These are the main “functional blocks” you’d show as ordered phases in a diagram.

6. **Shared utilities and state management**
   - `PSDHelper.ps1`, `PSDUtility.psm1`, `PSDDeploymentShare.psm1`, `PSDGather.psm1`, and `PSDStartLoader.psm1` provide shared functions and orchestration support.
   - `PSDWizard.psm1` / `PSDWizardNew.psm1` encapsulate wizard logic, while `PSDWizard.xaml` and the `PSDWizardNew` theme folders separate UI presentation from behavior.
   - The design is modular: phase scripts call common utility modules rather than duplicating logic.

7. **Prestart and endpoint-side UI**
   - `PSDResources/Prestart/` contains the WinPE prestart XML and scripts that present the initial menu and bootstrap the deployment experience.
   - This is the boundary between the boot environment and the actual deployment workflow.
   - `PSDResources/Readiness/` and `PSDResources/UserExitScripts/` add hooks for prechecks and customer-specific customization.

8. **Configuration and environment data**
   - `INIFiles/Bootstrap.ini` and `INIFiles/CustomSettings.ini` are the main configuration inputs that drive deployment behavior.
   - Additional XML files provide structured metadata such as languages, time zones, platform support, BIOS checks, NIC settings, and server manager settings.
   - These files act as the policy/configuration boundary separating environment-specific values from reusable deployment logic.

9. **Templates and deployment-share shape**
   - `Templates/` contains unattend and LiteTouch/PSD XML templates for x86/x64 and PE/full-OS phases.
   - These templates define how the target machine is prepared, what answer-file settings are applied, and how the deployment workflow is initialized.
   - For architecture purposes, this is the “output shape” consumed by MDT-like deployment shares and WinPE boot media.

10. **Wizard subsystem**
   - There are two wizard generations: legacy `Scripts/PSDWizard.*` and newer `Scripts/PSDWizardNew/`.
   - The newer wizard is theme-driven, with separate resource XAML files and localized pane definitions for device details, locale, readiness, applications, task sequence, target disk, and related choices.
   - Its role is to collect deployment-time inputs and feed them into the variable/configuration pipeline.

11. **Server provisioning and content delivery**
   - `Tools/New-PSDWebInstance.ps1`, `Tools/Set-PSDWebInstance.ps1`, `Tools/New-PSDRestPS.ps1`, and certificate scripts define the server-side hosting model.
   - The repository explicitly supports **IIS over HTTPS** for content delivery, and optionally **BITS + BranchCache** via 2Pint OSD Toolkit.
   - This is a significant architectural boundary: deployment content is fetched over network services rather than embedded locally.

12. **Plugins and extensibility**
   - `Plugins/OSDToolkit/Set-PSDBootImage2PintEnabled.ps1` shows integration with 2Pint tooling and boot image enablement.
   - The plugin model suggests PSD can be extended for alternate delivery or boot-image behaviors without changing the core scripts.
   - The repo also includes user-exit script hooks to allow custom actions at specific deployment points.

13. **Logging, validation, and operational support**
   - Scripts such as `PSDCopyLogs.ps1`, `PSDTest.ps1`, `PSDValidate.ps1`, and `Set-PSDLogInstance.ps1` support diagnostics and operational hardening.
   - Logging is an explicit part of the architecture, including server-side upload support referenced in the README.
   - These support scripts are the observability boundary for troubleshooting deployment runs.

14. **How to think about the full system**
   - A useful diagram would show: **boot/prestart in WinPE → wizard/config collection → validation/gathering → disk/driver/app/OS application → finalization/post-processing → logging back to server**.
   - Surrounding that runtime path are configuration files, templates, and server provisioning tools.
   - The repository is therefore best understood as a deployment framework composed of content, orchestration scripts, and hosting/setup utilities rather than a single executable service.

Main entry points: [`Scripts/PSDStart.ps1`](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDStart.ps1) (Start Loader), [`Tools/New-PSDWebInstance.ps1`](https://github.com/friendsofmdt/psd/blob/master/Tools/New-PSDWebInstance.ps1) (Web Instance), [`Install-PSD.ps1`](https://github.com/friendsofmdt/psd/blob/master/Install-PSD.ps1) (Install PSD), [`PSDResources/Prestart/PSDPrestartMenu.ps1`](https://github.com/friendsofmdt/psd/blob/master/PSDResources/Prestart/PSDPrestartMenu.ps1) (Prestart Menu)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bootstrap["Bootstrap"]
  node_install["Install PSD<br/>bootstrap entrypoint<br/>[Install-PSD.ps1]"]
end

subgraph group_runtime["Runtime"]
  node_prestart["Prestart<br/>winpe entrypoint<br/>[PSDPrestart.ps1]"]
  node_start["Start Loader<br/>orchestrator<br/>[PSDStart.ps1]"]
  node_gather["Gather<br/>phase<br/>[PSDGather.ps1]"]
  node_validate["Validate<br/>phase<br/>[PSDValidate.ps1]"]
  node_partition["Partition<br/>phase<br/>[PSDPartition.ps1]"]
  node_drivers["Drivers<br/>phase<br/>[PSDDrivers.ps1]"]
  node_apps["Applications<br/>phase"]
  node_applyos["Apply OS<br/>phase<br/>[PSDApplyOS.ps1]"]
  node_final["Finalization<br/>phase<br/>[PSDFinal.ps1]"]
  node_configure["Configure<br/>postdeploy phase<br/>[PSDConfigure.ps1]"]
  node_setvar["Set Variables<br/>state phase<br/>[PSDSetVariable.ps1]"]
  node_tattoo["Tattoo<br/>state phase<br/>[PSDTattoo.ps1]"]
  node_updatedisk["Update Disk<br/>maintenance phase<br/>[PSDUpdateDisk.ps1]"]
  node_wupdate["Windows Update<br/>maintenance phase"]
end

subgraph group_wizard["Wizard UI"]
  node_wizardold["Legacy Wizard<br/>ui module<br/>[PSDWizard.psm1]"]
  node_wizardnew["New Wizard<br/>ui module<br/>[PSDWizardNew.psm1]"]
  node_wizardxaml["Wizard Layout<br/>ui definition<br/>[PSDWizard.xaml]"]
  node_prestartmenu["Prestart Menu<br/>winpe ui"]
end

subgraph group_config["Config"]
  node_bootstrapini["Bootstrap INI<br/>config<br/>[Bootstrap.ini]"]
  node_customsettings["Custom Settings<br/>config<br/>[CustomSettings.ini]"]
  node_templates["Templates<br/>answer files<br/>[LiteTouchPE.xml]"]
  node_sharemeta["Share Metadata<br/>config modules"]
end

subgraph group_infra["Infrastructure"]
  node_webinst["Web Instance<br/>server setup"]
  node_restps["RestPS<br/>server setup<br/>[New-PSDRestPS.ps1]"]
  node_certs["Certs<br/>security setup"]
  node_logs["Log Instance<br/>ops tool"]
end

subgraph group_ext["Extensions"]
  node_pint["2Pint Plugin<br/>extension"]
end

node_install -->|"reads"| node_bootstrapini
node_install -->|"lays out"| node_templates
node_install -->|"enables"| node_prestart
node_prestart -->|"launches"| node_prestartmenu
node_prestartmenu -->|"opens"| node_wizardold
node_prestartmenu -->|"opens"| node_wizardnew
node_wizardold -->|"writes vars"| node_customsettings
node_wizardnew -->|"writes vars"| node_customsettings
node_customsettings -->|"drives"| node_start
node_start -->|"runs"| node_gather
node_gather -->|"runs"| node_validate
node_validate -->|"runs"| node_partition
node_partition -->|"runs"| node_drivers
node_drivers -->|"runs"| node_apps
node_apps -->|"runs"| node_applyos
node_applyos -->|"runs"| node_configure
node_configure -->|"runs"| node_setvar
node_setvar -->|"runs"| node_updatedisk
node_updatedisk -->|"runs"| node_tattoo
node_tattoo -->|"runs"| node_wupdate
node_wupdate -->|"runs"| node_final
node_start -->|"loads"| node_sharemeta
node_start -.->|"uses"| node_wizardold
node_start -.->|"uses"| node_wizardnew
node_start -.->|"emits"| node_logs
node_webinst -->|"depends on"| node_certs
node_webinst -.->|"pairs with"| node_restps
node_webinst -.->|"configures"| node_logs
node_pint -.->|"extends"| node_webinst
node_pint -.->|"feeds"| node_start

click node_install "https://github.com/friendsofmdt/psd/blob/master/Install-PSD.ps1"
click node_prestart "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDPrestart.ps1"
click node_start "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDStart.ps1"
click node_gather "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDGather.ps1"
click node_validate "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDValidate.ps1"
click node_partition "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDPartition.ps1"
click node_drivers "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDDrivers.ps1"
click node_apps "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDApplications.ps1"
click node_applyos "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDApplyOS.ps1"
click node_final "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDFinal.ps1"
click node_configure "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDConfigure.ps1"
click node_setvar "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDSetVariable.ps1"
click node_tattoo "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDTattoo.ps1"
click node_updatedisk "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDUpdateDisk.ps1"
click node_wupdate "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDWindowsUpdate.ps1"
click node_wizardold "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDWizard.psm1"
click node_wizardnew "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDWizardNew.psm1"
click node_wizardxaml "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDWizard.xaml"
click node_prestartmenu "https://github.com/friendsofmdt/psd/blob/master/PSDResources/Prestart/PSDPrestartMenu.ps1"
click node_bootstrapini "https://github.com/friendsofmdt/psd/blob/master/INIFiles/Bootstrap.ini"
click node_customsettings "https://github.com/friendsofmdt/psd/blob/master/INIFiles/CustomSettings.ini"
click node_templates "https://github.com/friendsofmdt/psd/blob/master/Templates/LiteTouchPE.xml"
click node_sharemeta "https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDDeploymentShare.psm1"
click node_webinst "https://github.com/friendsofmdt/psd/blob/master/Tools/New-PSDWebInstance.ps1"
click node_restps "https://github.com/friendsofmdt/psd/blob/master/Tools/New-PSDRestPS.ps1"
click node_certs "https://github.com/friendsofmdt/psd/blob/master/Tools/New-PSDServerCert.ps1"
click node_logs "https://github.com/friendsofmdt/psd/blob/master/Tools/Set-PSDLogInstance.ps1"
click node_pint "https://github.com/friendsofmdt/psd/blob/master/Plugins/OSDToolkit/Set-PSDBootImage2PintEnabled.ps1"

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_install toneBlue
class node_prestart,node_start,node_gather,node_validate,node_partition,node_drivers,node_apps,node_applyos,node_final,node_configure,node_setvar,node_tattoo,node_updatedisk,node_wupdate toneAmber
class node_wizardold,node_wizardnew,node_wizardxaml,node_prestartmenu toneMint
class node_bootstrapini,node_customsettings,node_templates,node_sharemeta toneRose
class node_webinst,node_restps,node_certs,node_logs toneIndigo
class node_pint toneTeal
```

## Components

### Bootstrap

Installer and deployment-share initialization.

- [Install PSD](https://github.com/friendsofmdt/psd/blob/master/Install-PSD.ps1): bootstrap entrypoint · Top-level installer that lays down the PSD framework and deployment-share structure. · `Install-PSD.ps1`

### Runtime

WinPE-to-OS deployment pipeline and shared orchestration.

- [Prestart](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDPrestart.ps1): winpe entrypoint · Initial WinPE handoff that starts the deployment experience and collects early choices. · `Scripts/PSDPrestart.ps1`
- [Start Loader](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDStart.ps1): orchestrator · Main runtime loader that coordinates the staged deployment flow. · `Scripts/PSDStart.ps1`
- [Gather](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDGather.ps1): phase · Collects environment data and deployment variables. · `Scripts/PSDGather.ps1`
- [Validate](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDValidate.ps1): phase · Checks readiness and deployment constraints before imaging continues. · `Scripts/PSDValidate.ps1`
- [Partition](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDPartition.ps1): phase · Prepares target disks and partitions for deployment. · `Scripts/PSDPartition.ps1`
- [Drivers](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDDrivers.ps1): phase · Selects or injects driver content for the target machine. · `Scripts/PSDDrivers.ps1`
- [Applications](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDApplications.ps1): phase · Stages application selection and installation. · `Scripts/PSDApplications.ps1`
- [Apply OS](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDApplyOS.ps1): phase · Applies the operating system image to the target device. · `Scripts/PSDApplyOS.ps1`
- [Finalization](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDFinal.ps1): phase · Performs post-deployment wrap-up and cleanup. · `Scripts/PSDFinal.ps1`
- [Configure](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDConfigure.ps1): postdeploy phase · Applies deployment configuration and environment-specific settings. · `Scripts/PSDConfigure.ps1`
- [Set Variables](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDSetVariable.ps1): state phase · Writes deployment variables into the runtime state. · `Scripts/PSDSetVariable.ps1`
- [Tattoo](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDTattoo.ps1): state phase · Persists selected machine state into the target OS. · `Scripts/PSDTattoo.ps1`
- [Update Disk](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDUpdateDisk.ps1): maintenance phase · Adjusts disk layout or metadata during deployment. · `Scripts/PSDUpdateDisk.ps1`
- [Windows Update](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDWindowsUpdate.ps1): maintenance phase · Runs post-deploy update handling. · `Scripts/PSDWindowsUpdate.ps1`

### Wizard UI

Interactive deployment input and theme-driven UI.

- [Legacy Wizard](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDWizard.psm1): ui module · Older wizard implementation used to gather deployment inputs. · `Scripts/PSDWizard.psm1`
- [New Wizard](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDWizardNew.psm1): ui module · Theme-driven wizard implementation with pane-based deployment UX. · `Scripts/PSDWizardNew.psm1`
- [Wizard Layout](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDWizard.xaml): ui definition · Shared XAML shell for the legacy wizard UI. · `Scripts/PSDWizard.xaml`
- [Prestart Menu](https://github.com/friendsofmdt/psd/blob/master/PSDResources/Prestart/PSDPrestartMenu.ps1): winpe ui · WinPE menu and bootstrap scripts that open the deployment flow. · `PSDResources/Prestart/PSDPrestartMenu.ps1`

### Config

INI, XML, and templates that shape deployment behavior.

- [Bootstrap INI](https://github.com/friendsofmdt/psd/blob/master/INIFiles/Bootstrap.ini): config · Core bootstrap configuration for deployment initialization. · `INIFiles/Bootstrap.ini`
- [Custom Settings](https://github.com/friendsofmdt/psd/blob/master/INIFiles/CustomSettings.ini): config · Primary deployment-share settings and policy inputs. · `INIFiles/CustomSettings.ini`
- [Templates](https://github.com/friendsofmdt/psd/blob/master/Templates/LiteTouchPE.xml): answer files · Unattend and LiteTouch/PSD templates for PE and full-OS phases. · `Templates/LiteTouchPE.xml`
- [Share Metadata](https://github.com/friendsofmdt/psd/blob/master/Scripts/PSDDeploymentShare.psm1): config modules · Shared definitions for deployment share behavior and platform metadata. · `Scripts/PSDDeploymentShare.psm1`

### Infrastructure

Server hosting, certificates, and delivery support.

- [Web Instance](https://github.com/friendsofmdt/psd/blob/master/Tools/New-PSDWebInstance.ps1): server setup · Creates and configures IIS-backed PSD web hosting. · `Tools/New-PSDWebInstance.ps1`
- [RestPS](https://github.com/friendsofmdt/psd/blob/master/Tools/New-PSDRestPS.ps1): server setup · Provisioning for the optional REST endpoint integration. · `Tools/New-PSDRestPS.ps1`
- [Certs](https://github.com/friendsofmdt/psd/blob/master/Tools/New-PSDServerCert.ps1): security setup · Creates server and root CA certificates used for HTTPS delivery. · `Tools/New-PSDServerCert.ps1`
- [Log Instance](https://github.com/friendsofmdt/psd/blob/master/Tools/Set-PSDLogInstance.ps1): ops tool · Configures centralized logging support for deployment operations. · `Tools/Set-PSDLogInstance.ps1`

### Extensions

Optional plugin integrations and hooks.

- [2Pint Plugin](https://github.com/friendsofmdt/psd/blob/master/Plugins/OSDToolkit/Set-PSDBootImage2PintEnabled.ps1): extension · Optional boot-image and BranchCache/BITS integration for OSD Toolkit. · `Plugins/OSDToolkit/Set-PSDBootImage2PintEnabled.ps1`

## Connections

- Install PSD → Bootstrap INI: reads · Installer uses bootstrap settings to provision the framework.
- Install PSD → Templates: lays out · Installer places the deployment templates and share shape.
- Install PSD → Prestart: enables · Bootstrap prepares the WinPE prestart entrypoint.
- Prestart → Prestart Menu: launches · WinPE prestart presents the initial menu and startup scripts.
- Prestart Menu → Legacy Wizard: opens · Legacy UI gathers deployment choices.
- Prestart Menu → New Wizard: opens · New theme-driven UI gathers deployment choices.
- Legacy Wizard → Custom Settings: writes vars · Wizard feeds collected choices into deployment settings.
- New Wizard → Custom Settings: writes vars · Wizard feeds collected choices into deployment settings.
- Custom Settings → Start Loader: drives · Deployment settings steer the runtime orchestrator.
- Start Loader → Gather: runs · Execution begins with environment and variable gathering.
- Gather → Validate: runs · Collected state is validated before imaging continues.
- Validate → Partition: runs · Validated deployment proceeds to disk preparation.
- Partition → Drivers: runs · Disk prep is followed by driver selection/injection.
- Drivers → Applications: runs · Driver stage hands off to application staging.
- Applications → Apply OS: runs · Application selection precedes OS application.
- Apply OS → Configure: runs · OS application transitions into configuration.
- Configure → Set Variables: runs · Configuration writes runtime variables and state.
- Set Variables → Update Disk: runs · Variable/state application can trigger disk updates.
- Update Disk → Tattoo: runs · Disk updates precede state persistence into the OS.
- Tattoo → Windows Update: runs · Persisted state is followed by post-deploy updates.
- Windows Update → Finalization: runs · Update handling concludes with finalization.
- Start Loader → Share Metadata: loads · Runtime orchestration uses shared deployment-share helpers.
- Start Loader → Legacy Wizard: uses · Core runtime can invoke the legacy wizard module.
- Start Loader → New Wizard: uses · Core runtime can invoke the newer wizard module.
- Start Loader → Log Instance: emits · Deployment flow records operational logs.
- Web Instance → Certs: depends on · HTTPS web hosting requires certificates.
- Web Instance → RestPS: pairs with · Web hosting can be paired with optional REST support.
- Web Instance → Log Instance: configures · Server-side hosting is tied to logging instance setup.
- 2Pint Plugin → Web Instance: extends · Plugin integration extends delivery and boot-image behavior.
- 2Pint Plugin → Start Loader: feeds · Extension can influence runtime boot/deployment behavior.
