vm-guest-tools.bat 2.21 KB
Newer Older
1
if not exist "C:\Windows\Temp\7z920-x64.msi" (
jcoutch's avatar
jcoutch committed
2
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
3
4
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
5

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

:vmware

13
if exist "C:\Users\vagrant\windows.iso" (
14
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
15
16
)

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

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

29
goto :done
30
31

:virtualbox
32

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

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

42
43
:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
jcoutch's avatar
jcoutch committed
44
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
45
46
	start /B /W """C:\Program Files\7-Zip\7z.exe"" x ""C:\Windows\Temp\prl-tools-win.iso"" -oC:\Windows\Temp\parallels"
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
jcoutch's avatar
jcoutch committed
47
	rd /S /Q "c:\Windows\Temp\parallels"
48
49
)

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