vm-guest-tools.bat 2.54 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
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/14.1.1/7528167/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
Stefan Scherer's avatar
Stefan Scherer committed
19
20
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
21
    rd /S /Q "C:\Program Files (x86)\VMWare"
22
23
)

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

27
28
29
rd /Q "C:\Windows\Temp\vmware-tools.tar"
rd /Q "C:\Windows\Temp\windows.iso"
rd /S /Q "C:\Windows\Temp\VMware"
30
goto :done
31
32

:virtualbox
33

Stefan Scherer's avatar
Stefan Scherer committed
34
35
36
37
38
if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
Stefan Scherer's avatar
Stefan Scherer committed
39
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.2.8/VBoxGuestAdditions_5.2.8.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
Stefan Scherer's avatar
Stefan Scherer committed
40
41
)

dylanmei's avatar
dylanmei committed
42
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
Stefan Scherer's avatar
Stefan Scherer committed
43
44
45
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha256-r3.cer
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha256.cer
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha1.cer
46
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
Stefan Scherer's avatar
Stefan Scherer committed
47
rd /S /Q "C:\Windows\Temp\virtualbox"
48
49
goto :done

50
51
:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
jcoutch's avatar
jcoutch committed
52
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
jcoutch's avatar
jcoutch committed
53
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
54
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
Stefan Scherer's avatar
Stefan Scherer committed
55
	rd /S /Q "C:\Windows\Temp\parallels"
56
57
)

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