function UpdateWindows { Write-Host "Updating Windows..." # Check if optional feature internet-explorer-optional-amd64 is installed $ieFeature = Get-WindowsOptionalFeature -Online -FeatureName internet-explorer-optional-amd64 if ($ieFeature.State -eq "Enabled") { Write-Host "Removing Internet Explorer." Disable-WindowsOptionalFeature -online -NoRestart -FeatureName internet-explorer-optional-amd64 } Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name PSWindowsUpdate -Force Get-WindowsUpdate -ForceInstall Install-WindowsUpdate -AcceptAll -IgnoreReboot }