Skip to content

Commit

Permalink
Merge pull request #243 from arizvisa/GH-185
Browse files Browse the repository at this point in the history
Install Windows Update KB2999226 on platforms which require it, and refactored vmtool.bat to use the executable directly for installing the VMware tools.

Closes issue #185.
  • Loading branch information
arizvisa authored Jun 12, 2020
2 parents 882f818 + dfed7e5 commit 8d4907d
Show file tree
Hide file tree
Showing 91 changed files with 517 additions and 124 deletions.
1 change: 1 addition & 0 deletions eval-win10x64-enterprise-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win10x64-enterprise-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win10x64-enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win10x86-enterprise-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win10x86-enterprise-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win10x86-enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2008r2-datacenter-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2008r2-datacenter-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2008r2-datacenter.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2008r2-standard-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2008r2-standard-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2008r2-standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2012r2-datacenter-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2012r2-datacenter-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2012r2-datacenter.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2012r2-standard-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2012r2-standard-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2012r2-standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2016-standard-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2016-standard-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win2016-standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win7x64-enterprise-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win7x64-enterprise-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win7x64-enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win7x86-enterprise-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win7x86-enterprise-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win7x86-enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win81x64-enterprise-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win81x64-enterprise-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win81x64-enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win81x86-enterprise-cygwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"remote_path": "C:/Windows/Temp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win81x86-enterprise-ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
"remote_path": "/tmp/script.bat",
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
1 change: 1 addition & 0 deletions eval-win81x86-enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
],
"scripts": [
"{{template_dir}}/script/vagrant.bat",
"{{template_dir}}/script/KB2999226.cmd",
"{{template_dir}}/script/cmtool.bat",
"{{template_dir}}/script/vmtool.bat",
"{{template_dir}}/script/clean.bat",
Expand Down
4 changes: 2 additions & 2 deletions floppy/_packer_config.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ set DISABLE_BITS=1
:: Use the following to set defaults for the wget.exe downloader when fetching
:: files used to provision the template. By default we try and download the
:: requested file up to 64 times.
set WGET_OPTS=-t 64
set WGET_OPTS=-t 64 --no-check-certificate

:: Use the following to set defaults for the curl.exe fallback downloader when
:: fetching files required for provisioning the template. This is a backup method,
:: so by default we retry if the connection is refused and we try to download
:: the requested file up to 64 times.
set CURL_OPTS=--retry-connrefused --retry 64
set CURL_OPTS=--retry-connrefused --retry 64 --retry-max-time 0 -k

:: Uncomment the following to change the pagefile size in MB as set by
:: floppy/pagefile.bat
Expand Down
28 changes: 10 additions & 18 deletions floppy/install-winrm.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

title Enabling Windows Remote Management. Please wait...

echo ==^> Turning off User Account Control (UAC)
echo ==^> Turning off User Account Control ^(UAC^)
:: see http://www.howtogeek.com/howto/windows-vista/enable-or-disable-uac-from-the-windows-vista-command-line/
reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
Expand Down Expand Up @@ -37,11 +37,14 @@ echo ==^> Changing remote UAC account policy
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

echo ==^> Blocking WinRM port 5985 on the firewall
netsh advfirewall firewall add rule name="winrm" dir=in action=block protocol=TCP localport=5985
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall add rule name="winrm" dir=in action=block protocol=TCP localport=5985
:: Disable the Windows Remote Management firewall group while we quickconfig winrm.
:: This group includes the rules WINRM-HTTP-In-TCP-NoScope, WINRM-HTTP-In-TCP-PUBLIC,
:: and WINRM-HTTP-In-TCP.
echo ==^> Blocking Windows Remote Management ^(WINRM-HTTP-In-TCP^) on the firewall
netsh advfirewall firewall set rule group="Windows Remote Management" new enable=no
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall set rule group="Windows Remote Management" new enable=no

echo ==^> Configuring Windows Remote Management (WinRM) service
echo ==^> Configuring Windows Remote Management ^(WinRM^) service

call winrm quickconfig -q
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm quickconfig -q
Expand Down Expand Up @@ -82,28 +85,17 @@ sc stop winrm

:is_winrm_running

timeout 1
timeout 5

sc query winrm | findstr "STOPPED" >nul
if errorlevel 1 goto is_winrm_running

:winrm_not_running

echo ==^> Unblocking WinRM port 5985 on the firewall
netsh advfirewall firewall delete rule name="winrm"
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall delete rule name="winrm"

netsh advfirewall firewall set rule group="remote administration" new enable=yes
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall set rule group="remote administration" new enable=yes

echo ==^> Opening WinRM port 5985 on the firewall
:: see http://social.technet.microsoft.com/Forums/windowsserver/en-US/a1e65f0f-2550-49ae-aee2-56a9bdcfb8fb/windows-7-remote-administration-firewall-group?forum=winserverManagement
echo ==^> Restoring Windows Remote Management ^(WINRM-HTTP-In-TCP^) on the firewall
netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes

netsh advfirewall firewall add rule name="winrm" dir=in action=allow protocol=TCP localport=5985
@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall add rule name="winrm" dir=in action=allow protocol=TCP localport=5985

:exit0

ver>nul
Expand Down
Loading

0 comments on commit 8d4907d

Please sign in to comment.