Private/Resolve-WUWSUSIssues.ps1

function Resolve-WUWSUSIssues {
    <#
    .SYNOPSIS
        Resolves Windows Server Update Services (WSUS) compatibility issues.
 
    .DESCRIPTION
        Applies registry fixes for WSUS compatibility issues, particularly for
        Windows 11 24H2 deployment scenarios that may encounter error 0x80240069.
 
    .PARAMETER LogPath
        Path to the log file for detailed logging.
 
    .EXAMPLE
        $result = Resolve-WUWSUSIssues -LogPath "C:\Logs\wu.log"
 
    .NOTES
        This is a private function used internally by the WindowsUpdateTools module.
        Returns an object with Success, IssuesFixed, and ActionsPerformed properties.
    #>


    [CmdletBinding()]
    param(
        [string]$LogPath
    )
    
    $result = [PSCustomObject]@{
        Success = $false
        IssuesFixed = 0
        ActionsPerformed = @()
    }
    
    try {
        Write-WULog -Message "Checking for Windows 11 24H2 WSUS deployment issues..." -LogPath $LogPath
        
        # Check for WSUS
        $wsusServer = Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUServer" -ErrorAction SilentlyContinue
        $osVersion = (Get-CimInstance Win32_OperatingSystem).Version
        
        if ($wsusServer -and $osVersion -like "10.0.22*") {
            Write-WULog -Message "WSUS environment detected with Windows 11 - applying 24H2 compatibility fixes" -LogPath $LogPath
            
            # Apply the critical registry fix for error 0x80240069
            $regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\FeatureManagement\Overrides\8\3000950414"
            if (-not (Test-Path $regPath)) {
                New-Item -Path $regPath -Force | Out-Null
            }
            Set-ItemProperty -Path $regPath -Name "EnabledState" -Value 1 -Type DWord
            Set-ItemProperty -Path $regPath -Name "EnabledStateOptions" -Value 0 -Type DWord
            Write-WULog -Message "Applied Windows 11 24H2 WSUS registry fix" -LogPath $LogPath
            
            $result.IssuesFixed++
            $result.ActionsPerformed += "Windows 11 24H2 WSUS compatibility fix"
        }
        
        $result.Success = $true
    }
    catch {
        Write-WULog -Message "Error applying WSUS fixes: $($_.Exception.Message)" -Level Error -LogPath $LogPath
    }
    
    return $result
}