Commit 12d427c8 authored by Stefan Scherer's avatar Stefan Scherer Committed by GitHub

Merge pull request #106 from aaronk1/patch-1

Update win-updates.ps1
parents 6800a171 66a9005b
......@@ -10,7 +10,7 @@ function LogWrite {
Param ([string]$logstring)
$now = Get-Date -format s
Add-Content $Logfile -value "$now $logstring"
Write-Host $logstring
Write-Output $logstring
}
function Check-ContinueRestartOrEnd() {
......@@ -31,10 +31,10 @@ function Check-ContinueRestartOrEnd() {
Install-WindowsUpdates
} elseif ($script:Cycles -gt $global:MaxCycles) {
LogWrite "Exceeded Cycle Count - Stopping"
Invoke-Expression "a:\enable-winrm.ps1"
& "a:\enable-winrm.ps1"
} else {
LogWrite "Done Installing Windows Updates"
Invoke-Expression "a:\enable-winrm.ps1"
& "a:\enable-winrm.ps1"
}
}
1 {
......@@ -64,7 +64,7 @@ function Install-WindowsUpdates() {
$CurrentUpdates = $SearchResult.Updates
while($script:i -lt $CurrentUpdates.Count -and $script:CycleUpdateCount -lt $MaxUpdatesPerCycle) {
$Update = $CurrentUpdates.Item($script:i)
if (($Update -ne $null) -and (!$Update.IsDownloaded)) {
if (($null -ne $Update) -and (!$Update.IsDownloaded)) {
[bool]$addThisUpdate = $false
if ($Update.InstallationBehavior.CanRequestUserInput) {
LogWrite "> Skipping: $($Update.Title) because it requires user input"
......@@ -126,7 +126,7 @@ function Install-WindowsUpdates() {
LogWrite 'No updates available to install...'
$global:MoreUpdates=0
$global:RestartRequired=0
Invoke-Expression "a:\enable-winrm.ps1"
& "a:\enable-winrm.ps1"
break
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment