Get-BitsJobError
Find the BITS job behind a download error. Lists the BITS jobs and prints the lines that mention an error code. Read only.
Fixes these codes
What it does
Use this for error 0x80072EFE and other failed update downloads. Windows Update downloads through BITS (the Background Intelligent Transfer Service).
It runs BITSADMIN /LIST /ALLUSERS /VERBOSE, which is the command Microsoft's guidance uses, then prints the lines that mention the error code. The matching job shows an HTTP code and the file that failed. A firewall, proxy or web filter blocking that address is the usual cause.
Parameters
-ErrorCode: The code to look for, with or without 0x. The default is 0x80072EFE.
Examples
.\Get-BitsJobError.ps1
Looks for 0x80072EFE.
.\Get-BitsJobError.ps1 -ErrorCode 0x80072EE2
Looks for a different code.
Notes
The output can include file paths and web addresses. Read it before you share it.
Microsoft's guidance
The script
Click the script to select all of it, then copy. Fingerprint of this text (SHA-256): 4a7b941ebeab1f610d8f816a2dcbbe943a01d63a44b52a08c3406a23cd3511f1. Updated 2026-10-21.
# Copyright (c) 2026 Owen Perry. All rights reserved.
#Requires -Version 5.1
#Requires -RunAsAdministrator
<#
.SYNOPSIS
Lists the BITS jobs and finds the one that carries an error code. Changes nothing.
.DESCRIPTION
Use this for error 0x80072EFE and other failed update downloads. Windows Update downloads through BITS (the Background Intelligent Transfer Service).
It runs BITSADMIN /LIST /ALLUSERS /VERBOSE, which is the command Microsoft's guidance uses, then prints the lines that mention the error code.
The matching job shows an HTTP code and the file that failed. A firewall, proxy or web filter blocking that address is the usual cause.
.PARAMETER ErrorCode
The code to look for, with or without 0x. The default is 0x80072EFE.
.EXAMPLE
.\Get-BitsJobError.ps1
Looks for 0x80072EFE.
.EXAMPLE
.\Get-BitsJobError.ps1 -ErrorCode 0x80072EE2
Looks for a different code.
.NOTES
The output can include file paths and web addresses. Read it before you share it.
.LINK
https://learn.microsoft.com/en-us/troubleshoot/windows-client/installing-updates-features-roles/common-windows-update-errors
#>
[CmdletBinding()]
param([ValidatePattern('^(0x)?[0-9A-Fa-f]{1,8}$')][string]$ErrorCode = '0x80072EFE')
$ErrorActionPreference = 'Stop'
# BITSADMIN is an older tool, but it is what Microsoft's guidance uses. Each output line becomes one string.
$output = & "$env:windir\System32\bitsadmin.exe" /list /allusers /verbose 2>&1 | ForEach-Object { "$_" }
$output
# If BITSADMIN could not list the jobs (for example without admin rights), say so. An empty result would be misleading.
if ($LASTEXITCODE -ne 0 -or ($output | Select-String -SimpleMatch 'Unable to enum jobs')) {
Write-Error 'BITSADMIN could not list the jobs. Run this from an elevated PowerShell window.'
exit 1
}
# Search for the code without its 0x prefix, ignoring upper and lower case.
$needle = $ErrorCode -replace '^0x', ''
$hits = @($output | Select-String -SimpleMatch $needle)
''
if ($hits.Count -gt 0) {
Write-Host "Lines that mention ${ErrorCode}:"
$hits | ForEach-Object { ' ' + $_.Line.Trim() }
} else {
Write-Host "No BITS job mentions $ErrorCode. The failed job may already be gone. Try the update again, then run this straight away."
}