> For the complete documentation index, see [llms.txt](https://www.osdeploy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.osdeploy.com/osdeploy-insider/how-to/osdeploy-core-removing-boot-images.md).

# OSDeploy Core: Removing Boot Images

Review and remove completed OSDeploy Boot image builds that are no longer required.

`Build-OSDeployBoot` creates a new output directory for every build. Existing directories are not replaced; duplicate names receive a numeric suffix such as `-001`. Remove obsolete builds to recover space under:

```
C:\ProgramData\OSDeployCore\boot
```

{% hint style="warning" %}
Do not remove a build that is being copied to USB, used by a virtual machine, or updated by `Update-OSDeployBootISO`. Keep at least one tested boot image until its replacement has been validated.
{% endhint %}

## Understand the Build Directory

A completed build can contain:

```
<build-name>\
|-- .core\
|-- .temp\
|   `-- logs\
|-- bootmedia\
|   `-- sources\
|       `-- boot.wim
|-- bootmedia.iso
|-- bootmedia_ca2023\
`-- bootmedia_ca2023.iso
```

The `bootmedia_ca2023` content is present only when the selected WinRE source contains compatible updated Secure Boot files.

Deleting the complete build directory removes its WIM, ISO, logs, and generated media trees. It does not remove imported Windows OS or WinRE source images, shared Boot-Assets content, or cached applications.

## Review Boot Images

Close active OSDeploy builds and open an elevated PowerShell 7 session.

List every build with its ISO files and approximate size:

```powershell
$BootRoot = Join-Path $env:ProgramData 'OSDeployCore\boot'

$BootImages = Get-ChildItem -LiteralPath $BootRoot -Directory -ErrorAction SilentlyContinue |
    ForEach-Object {
        $Files = Get-ChildItem -LiteralPath $_.FullName -File -Recurse -ErrorAction SilentlyContinue
        [pscustomobject]@{
            Name = $_.Name
            ModifiedTime = $_.LastWriteTime
            SizeGB = [math]::Round(($Files | Measure-Object Length -Sum).Sum / 1GB, 2)
            ISO = (@($Files | Where-Object Extension -eq '.iso').Name -join ', ')
            Path = $_.FullName
        }
    } |
    Sort-Object ModifiedTime -Descending

$BootImages | Format-Table Name, ModifiedTime, SizeGB, ISO -AutoSize
```

The newest ISO is selected automatically by `New-OSDeployHyperVM` when `-ISO` is omitted. Confirm that an older build is not still required before removing it.

## Select Builds to Remove

Use `Out-GridView` to select obsolete build directories:

```powershell
$OldBootImages = $BootImages |
    Out-GridView -Title 'Select OSDeploy Boot images to remove' -PassThru

$OldBootImages | Format-Table Name, ModifiedTime, SizeGB, Path -AutoSize
```

If the selection is incorrect, run the selection command again.

## Preview and Remove

Preview the deletion:

```powershell
$OldBootImages.Path | Remove-Item -Recurse -Force -WhatIf
```

Confirm that every path is a direct child of `C:\ProgramData\OSDeployCore\boot`.

Remove the selected builds with a confirmation for each directory:

```powershell
$OldBootImages.Path | Remove-Item -Recurse -Force -Confirm
```

Do not remove the `boot` root. OSDeploy uses it for future build output.

## Verify and Rebuild

List the remaining content:

```powershell
Get-ChildItem -LiteralPath $BootRoot -Directory |
    Sort-Object LastWriteTime -Descending |
    Select-Object Name, LastWriteTime, FullName
```

Create replacement media when required:

```powershell
Build-OSDeployBoot
```

OSDeploy creates a new build directory; it does not restore the deleted directory name or its previous selections automatically.

See [Build-OSDeployBoot](/guide/cmdlets/build-osdeployboot.md) for build behavior and [Update-OSDeployBootISO](/guide/cmdlets/update-osdeploybootiso.md) for rebuilding ISO files from a retained media tree.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.osdeploy.com/osdeploy-insider/how-to/osdeploy-core-removing-boot-images.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
