vm-guest-tools.bat 1.58 KB
Newer Older
1
2
3
4
if not exist "C:\Windows\Temp\7z920-x64.msi" (
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/sevenzip/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
5

6
7
8
if "%PACKER_BUILDER_TYPE%" equ "vmware" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox" goto :virtualbox
goto :done
9
10
11
12

:vmware

if not exist "C:\Windows\Temp\VMWare\setup.exe" (
13
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/10.0.0/1295980/windows/packages/tools-windows-9.6.0.exe.tar', 'C:\Windows\Temp\vmware-tools.exe.tar')" <NUL
14
15
16
17
18
19
20
  cmd /c "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.exe.tar -oC:\Windows\Temp
  cmd /c C:\Windows\Temp\tools-windows-9.6.0
  cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Program Files (x86)\VMWare\tools-windows\windows.iso" -oC:\Windows\Temp\VMWare"
  del /F /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"
21
goto :done
22
23

:virtualbox
24

25
26
27
:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer
28
29
30
31
32
33
34
35

mv C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
cmd /c "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
goto :done

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi