hardcoded WUServer

This commit is contained in:
2025-10-18 16:32:05 -05:00
parent 31616fd548
commit 6562e8d36b

View File

@@ -23,7 +23,7 @@ $PSModulePathAU = $env:PSModulePath.split(';')[1] # All Users PSModule path
if ($MDT){
$MDTPath = $Global:TSEnv.Value("DeployRoot")
}
$WUServer = (Get-ItemProperty HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate).WUServer
$WUServer = "http://fluttershy.technolog.net:8530"
## Functions
@@ -58,17 +58,17 @@ Function RunWinUpdate { # Run Windows Updates
try {
Write-LogEntry -Value "Installing all available Windows Updates..." -Severity 1 -Component "RunWinUpdate" -FileName $ScriptLog
Write-Host -ForegroundColor Yellow "Installing all available Windows Updates..."
if ($WUServer -and !($Reboot)){
Install-WindowsUpdate -AcceptAll -IgnoreReboot
#Requires -RunAsAdministrator
} elseif ($WUServer -and $Reboot) {
Install-WindowsUpdate -AcceptAll -AutoReboot
if (($null -eq $WUServer) -and !($Reboot)){
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot
#Requires -RunAsAdministrator
} elseif (($null -eq $WUServer) -and $Reboot){
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot
#Requires -RunAsAdministrator
} elseif ($WUServer -and $Reboot) {
Install-WindowsUpdate -AcceptAll -AutoReboot
#Requires -RunAsAdministrator
} else {
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot
Install-WindowsUpdate -AcceptAll -IgnoreReboot
#Requires -RunAsAdministrator
}
return $true