vm-guest-tools.bat 1.81 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
14
15
if exist "C:\Users\vagrant\windows.iso" (
	move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

16
17
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
18
  cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.exe.tar -oC:\Windows\Temp"
Joe Fitzgerald's avatar
Joe Fitzgerald committed
19
  FOR /r "C:\Windows\Temp" %%a in (tools-windows-*.exe) DO REN "%%~a" "tools-windows.exe"
20
  cmd /c C:\Windows\Temp\tools-windows
21
22
  move /Y "C:\Program Files (x86)\VMware\tools-windows\windows.iso" C:\Windows\Temp
  rd /S /Q "C:\Program Files (x86)\VMWare"
23
24
)

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

28
goto :done
29
30

:virtualbox
31

32
33
34
:: 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
35

36
move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
dylanmei's avatar
dylanmei committed
37
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
38
39
40
41
42
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
goto :done

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