Automate the troubleshooting of network issue caused by Windows 11 24H2 Update

Automate the troubleshooting of network issue caused by Windows 11 24H2 Update

After upgrading to Windows 11 24H2, some computer clients cannot access network via LAN or WLAN because of missing network gateway that the DHCP server cannot request. Manually typing the gateway does not help neither because it is lost again after system restart.

Bear in mind that this internet disconnection issue is caused by a Windows 11 24H2 update from Microsoft, and this is not an issue with your internet router.

The following is a PowerShell script to automate the following steps:

  1. Open the Registry Editor and go to: HKEY_LOCAL_MACHINE > System > CurrentControlSet > Services > WcmSvc
  2. Locate the entry called DependOnService
  3. Open it and remove the line WinHTTPAutoProxySvc
  4. Save the changes
  5. Restart Windows Connection Manager (WcmSvc) service

To use this script:

  • Save it as Fix-InternetConnection.ps1
  • Right-click and Run with PowerShell (requires admin privileges)
  • Accept UAC prompt if asked

Features:

  • Automatic admin elevation
  • Checks if modification is needed before making changes
  • Preserves existing service dependencies
  • Error handling and status reporting
  • Service restart verification

#Requires -RunAsAdministrator



<#

.SYNOPSIS

Resolves Windows 11 24H2 update-related internet connectivity issues by modifying service dependencies and restarting affected services.

#>



try {

  $regPath = "HKLM:\System\CurrentControlSet\Services\WcmSvc"

  $valueName = "DependOnService"



  # Check if the registry value exists

  if (-not (Get-ItemProperty -Path $regPath -Name $valueName -ErrorAction SilentlyContinue)) {

    Write-Warning "DependOnService entry not found in WcmSvc registry key."

    exit 1

  }



  # Get current dependencies and remove WinHTTPAutoProxySvc

  $currentValues = Get-ItemPropertyValue -Path $regPath -Name $valueName

  $newValues = $currentValues | Where-Object { $_ -ne 'WinHTTPAutoProxySvc' }



  # Update registry if changes are needed

  if ($newValues.Count -ne $currentValues.Count) {

    Set-ItemProperty -Path $regPath -Name $valueName -Value $newValues

    Write-Host "Successfully updated DependOnService entries." -ForegroundColor Green

  }

  else {

    Write-Host "WinHTTPAutoProxySvc dependency not found - no changes made." -ForegroundColor Yellow

  }



  # Restart Windows Connection Manager service

  Restart-Service -Name WcmSvc -Force

  Write-Host "Windows Connection Manager service restarted successfully." -ForegroundColor Green

}

catch {

  Write-Error "An error occurred: $_"

  exit 1

}        

要查看或添加评论,请登录

Hamdi Bouasker的更多文章

社区洞察

其他会员也浏览了