Commit 3300d5f4 authored by dylanmei's avatar dylanmei
Browse files

Ensure win-updates fires correctly wip

parent 5f29bbec
......@@ -224,20 +224,29 @@
<Order>21</Order>
<Description>Disable Hibernation Mode</Description>
</SynchronousCommand>
<!--
<!-- WITHOUT WINDOWS UPDATES
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1</CommandLine>
<Description>Install Windows Updates</Description>
<Order>22</Order>
<CommandLine>cmd.exe /c a:\openssh-6.2.bat START</CommandLine>
<Description>Install OpenSSH</Description>
<Order>99</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
-->
</SynchronousCommand> -->
<!-- WITH WINDOWS UPDATES -->
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c a:\openssh-6.2.bat</CommandLine>
<Description>Install OpenSSH</Description>
<Order>99</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1</CommandLine>
<Description>Install Windows Updates</Description>
<Order>100</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
</FirstLogonCommands>
<ShowWindowsLive>false</ShowWindowsLive>
</component>
......
......@@ -15,6 +15,10 @@ rd /S /Q "C:\Program Files\OpenSSH\tmp"
cmd /c ""C:\Program Files\OpenSSH\bin\junction.exe" /accepteula "C:\Program Files\OpenSSH\tmp" C:\Windows\Temp"
cmd /c C:\Windows\System32\icacls.exe "C:\Windows\Temp" /grant vagrant:(OI)(CI)F
if "%1" neq "START" (
cmd /c net stop opensshd
)
:: configure firewall
netsh advfirewall firewall add rule name="SSHD" dir=in action=allow service=OpenSSHd enable=yes
netsh advfirewall firewall add rule name="SSHD" dir=in action=allow program="C:\Program Files\OpenSSH\usr\sbin\sshd.exe" enable=yes
......
......@@ -15,11 +15,14 @@ function Check-ContinueRestartOrEnd() {
Write-Host "No Restart Required"
Check-WindowsUpdates
if (($global:MoreUpdates -eq 1) -and ($script:Cycles -le $global:MaxCycles)) {
Stop-Service $script:ServiceName -Force
Set-Service -Name $script:ServiceName -StartupType Disabled -Status Stopped
Install-WindowsUpdates
} elseif ($script:Cycles -gt $global:MaxCycles) {
Write-Host "Exceeded Cycle Count - Stopping"
} else {
Write-Host "Done Installing Windows Updates"
Set-Service -Name $script:ServiceName -StartupType Automatic -Status Running
}
}
1 {
......@@ -155,6 +158,11 @@ $script:UpdateSearcher = $script:UpdateSession.CreateUpdateSearcher()
$script:SearchResult = New-Object -ComObject 'Microsoft.Update.UpdateColl'
$script:Cycles = 0
$script:ServiceName = "OpenSSHd"
Stop-Service $script:ServiceName -Force
Set-Service -Name $script:ServiceName -StartupType Disabled -Status Stopped
Check-WindowsUpdates
if ($global:MoreUpdates -eq 1) {
Install-WindowsUpdates
......
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