File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed
Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ def builders
4545 'winrm_use_ssl' => 'true' ,
4646 'winrm_insecure' => 'true' ,
4747 'winrm_timeout' => '1h' ,
48- 'winrm_username' => 'packer'
48+ 'winrm_username' => 'packer' ,
49+ 'custom_script' => 'powershell -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -Command "Add-WindowsCapability -Online -Name (Get-WindowsCapability -Online -Name OpenSSH.Server* | ForEach-Object Name)"'
4950 }
5051 ]
5152 end
Original file line number Diff line number Diff line change @@ -34,5 +34,10 @@ if (-not (Get-Command Enable-WinRM -errorAction SilentlyContinue))
3434Write-Log "Invoking WinRM"
3535Enable-WinRM
3636
37+ Write-Log "Install OpenSSH.Server"
38+ Write-Log (Get-WindowsCapability -Online -Name "OpenSSH.Server*" | Format-List | Out-String)
39+ Add-WindowsCapability -Online -Name (Get-WindowsCapability -Online -Name "OpenSSH.Server*" | ForEach-Object Name)
40+ Write-Log (Get-WindowsCapability -Online -Name "OpenSSH.Server*" | Format-List | Out-String)
41+
3742Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope LocalMachine
3843</powershell>
Original file line number Diff line number Diff line change @@ -32,3 +32,8 @@ if (-not (Get-Command Enable-WinRM -errorAction SilentlyContinue))
3232
3333Write-Log " Invoking WinRM"
3434Enable-WinRM
35+
36+ Write-Log " Install OpenSSH.Server"
37+ Write-Log (Get-WindowsCapability - Online - Name " OpenSSH.Server*" | Format-List | Out-String )
38+ Add-WindowsCapability - Online - Name (Get-WindowsCapability - Online - Name " OpenSSH.Server*" | ForEach-Object Name)
39+ Write-Log (Get-WindowsCapability - Online - Name " OpenSSH.Server*" | Format-List | Out-String )
You can’t perform that action at this time.
0 commit comments