Public/Remove-UpdatePackages.ps1

function Remove-UpdatePackages
{
    <#
        .DESCRIPTION
            Remove all packages associated with a specific Windows Build number
    
        .PARAMETER Build Number
            The build number associated with packages to be removed
    
        .EXAMPLE
            Remove-WindowsUpdate -BuildNumber 22000.978
    
        .NOTES
            Created by: Jon Anderson
            Modified: 2023-07-10
    #>

        [CmdletBinding()]
        param(
            [parameter(Mandatory = $true)][ValidateNotNullOrEmpty()]
            [String]$BuildNumber
        )
    
        $Packages = Dism /Online /Get-Packages | Select-String $BuildNumber
        foreach($Package in $Packages)
        {
            if($Package -match "Package Identity")
            {
                $PackageName = Out-String -InputObject $Package | ForEach-Object {($_.Split(":"))[1].Trim()}
                Write-LogEntry -Value "Removing package: $PackageName" -Severity 1
                try
                {
                    Dism /Online /Remove-Package /PackageName:$PackageName /Quiet /NoRestart
                }
                catch
                {
                    Write-LogEntry -Value "Failed to remove package: $PackageName`n$($PSItem.Exception.Message)" -Severity 3
                }
            }
        }
    }