> 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-winre-images.md).

# OSDeploy Core: Removing WinRE Images

Review and remove imported Windows Recovery Environment images from the OSDeploy Core cache.

`Update-OSDeployCoreRE` creates a Windows Recovery Environment source for each imported Windows OS source. Remove obsolete WinRE imports to recover space or remove old source choices from `Build-OSDeployBoot`:

```
C:\ProgramData\OSDeployCore\cache\windows-re
```

{% hint style="warning" %}
`Build-OSDeployBoot` discovers WinRE sources from this directory. Keep at least one tested source for every architecture that requires WinRE-based media. When no compatible WinRE source is available, the build can fall back to the Windows ADK WinPE image.
{% endhint %}

## Understand the WinRE Source Directory

Each source normally contains:

```
<source-name>\
|-- .core\
|-- .temp\
|-- .wim\
|   `-- winre.wim
`-- properties.json
```

The source name matches the paired directory under `cache\windows-os`. OSDeploy reads `properties.json` and `.wim\winre.wim` to populate WinRE source selection.

Deleting a WinRE source does not delete its paired Windows OS source, cached Enterprise ESD, or completed boot media.

## Review Imported WinRE Images

Close active import and build operations, then open an elevated PowerShell 7 session.

List valid WinRE sources and approximate size:

```powershell
$WindowsRERoot = Join-Path $env:ProgramData 'OSDeployCore\cache\windows-re'

$WindowsREImages = Get-ChildItem -LiteralPath $WindowsRERoot -Directory -ErrorAction SilentlyContinue |
    ForEach-Object {
        $PropertiesPath = Join-Path $_.FullName 'properties.json'
        $Properties = if (Test-Path -LiteralPath $PropertiesPath) {
            Get-Content -LiteralPath $PropertiesPath -Raw | ConvertFrom-Json
        }
        $ImagePath = Join-Path $_.FullName '.wim\winre.wim'
        $Size = Get-ChildItem -LiteralPath $_.FullName -File -Recurse -ErrorAction SilentlyContinue |
            Measure-Object Length -Sum

        [pscustomobject]@{
            Name = $_.Name
            Version = $Properties.Version
            Architecture = $Properties.Architecture
            HasWinRE = Test-Path -LiteralPath $ImagePath -PathType Leaf
            ModifiedTime = $_.LastWriteTime
            SizeGB = [math]::Round($Size.Sum / 1GB, 2)
            Path = $_.FullName
        }
    } |
    Sort-Object Version -Descending

$WindowsREImages |
    Format-Table Name, Version, Architecture, HasWinRE, ModifiedTime, SizeGB -AutoSize
```

Entries with `HasWinRE` set to `False` are incomplete and are not usable build sources.

## Select WinRE Images to Remove

```powershell
$OldWindowsREImages = $WindowsREImages |
    Out-GridView -Title 'Select imported WinRE images to remove' -PassThru

$OldWindowsREImages |
    Format-Table Name, Version, Architecture, HasWinRE, SizeGB, Path -AutoSize
```

Keep the newest known-working source for each required architecture.

## Preview and Remove

Preview the deletion:

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

Confirm that every selected path is a direct child of `C:\ProgramData\OSDeployCore\cache\windows-re`.

Remove the selected sources:

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

Do not remove the `windows-re` root.

## Verify Build Source Selection

Run an interactive preview of the build source choices:

```powershell
Build-OSDeployBoot -WhatIf
```

Select a retained WinRE source and review the displayed build configuration. `-WhatIf` prevents the build-directory operation, but initialization and selection can still update local state.

## Restore a WinRE Source

Recreate a removed source from the verified Enterprise ESD:

```powershell
Update-OSDeployCoreRE
```

Restore one architecture when required:

```powershell
Update-OSDeployCoreRE -Architecture 'arm64'
```

If the ESD is absent, run `Update-OSDeployCoreESD` first. The import ensures that matching Windows OS and WinRE source directories exist.

See [OSDeployCore Cache](/osdeploy-insider/reference/osdeploycore-cache.md) for the paired source layout and [Convert ESD to Windows RE](/osdeploy-insider/reference/convert-esd-to-windows-re.md) for the extraction workflow.


---

# 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-winre-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.
