Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Bob Tanner
packer-windows
Commits
12d427c8
Unverified
Commit
12d427c8
authored
Jul 07, 2018
by
Stefan Scherer
Committed by
GitHub
Jul 07, 2018
Browse files
Merge pull request #106 from aaronk1/patch-1
Update win-updates.ps1
parents
6800a171
66a9005b
Changes
1
Show whitespace changes
Inline
Side-by-side
scripts/win-updates.ps1
View file @
12d427c8
...
...
@@ -10,7 +10,7 @@ function LogWrite {
Param
([
string
]
$logstring
)
$now
=
Get-Date
-format
s
Add-Content
$Logfile
-value
"
$now
$logstring
"
Write-
Hos
t
$logstring
Write-
Outpu
t
$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
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment