diff --git a/configwinpc.ps1 b/configwinpc.ps1 index 4d47bc5..08df896 100644 --- a/configwinpc.ps1 +++ b/configwinpc.ps1 @@ -667,6 +667,19 @@ Set-ItemProperty -Path $WindowsUpdateRegistryPath -Name "NoAutoRebootWithLoggedO #################################################################################################################################### +Write-Host -ForegroundColor Yellow ">>> Turn Off Windows Update Delivery Optimization <<<" + +$RegistryPaths = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Settings" +# Check if the path exists +if (-not (Test-Path $RegistryPaths)) { + # Create the path if it doesn't exist + New-Item -Path $RegistryPaths -Force | Out-Null +} + +Set-ItemProperty -Path $RegistryPaths -Name "DownloadMode" -Value 0 -Force | Out-Null + +#################################################################################################################################### + # Restart File Explorer to apply the changes taskkill /f /im explorer.exe | Out-Null @@ -679,6 +692,7 @@ start explorer.exe | Out-Null ########################################################################################## # Checking for Available Updates +Install-PackageProvider -Name NuGet -Force Install-Module -Name PSWindowsUpdate -Force -Confirm:$False Write-Host "" @@ -687,8 +701,11 @@ Get-WindowsUpdate Write-Host "" # Installing Windows Updates -Write-Host -ForegroundColor Yellow ">>> Installing Windows Updates... <<<" +Write-Host -ForegroundColor Yellow ">>> Installing Windows and Driver Updates... <<<" Install-WindowsUpdate -AcceptAll -Install -IgnoreReboot +Install-WindowsUpdate -Install -AcceptAll -UpdateType Driver -MicrosoftUpdate -ForceDownload -ForceInstall -IgnoreReboot +Install-WindowsUpdate -Install -AcceptAll -UpdateType Software -MicrosoftUpdate -ForceDownload -ForceInstall -IgnoreReboot + Write-Host "" ##########################################################################################