vm-guest-tools.bat 1.71 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

:vmware

12
13
if not exist "C:\Windows\Temp\windows.iso" (
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/10.0.1/1379776/windows/packages/tools-windows-9.6.1.exe.tar', 'C:\Windows\Temp\vmware-tools.exe.tar')" <NUL
dylanmei's avatar
dylanmei committed
14
  cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.exe.tar -oC:\Windows\Temp"
15
16
17
18
  FOR /r "C:\Windows\Temp" %a in (tools-windows-*.exe) DO REN "%~a" "tools-windows.exe"
  cmd /c C:\Windows\Temp\tools-windows.exe
  move /Y "C:\Program Files (x86)\VMware\tools-windows\windows.iso" C:\Windows\Temp
  rd /S /Q "C:\Program Files (x86)\VMWare"
19
20
)

21
cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
22
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"
23

24
goto :done
25
26

:virtualbox
27

28
29
30
:: 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
31
32

mv C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
dylanmei's avatar
dylanmei committed
33
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
34
35
36
37
38
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
goto :done

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