68 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Batchfile
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Batchfile
		
	
	
		
			Executable File
		
	
	
	
	
| if not exist "C:\Windows\Temp\7z920-x64.msi" (
 | |
|     powershell -Command "Start-Sleep 5; Invoke-WebRequest -Uri 'https://astuteinternet.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7z920-x64.msi' -Outfile 'C:\Windows\Temp\7z920-x64.msi'" <NUL
 | |
| )
 | |
| if not exist "C:\Windows\Temp\7z920-x64.msi" (
 | |
|     powershell -Command "Start-Sleep 5; Invoke-WebRequest -Uri 'http://www.7-zip.org/a/7z920-x64.msi' -Outfile 'C:\Windows\Temp\7z920-x64.msi')" <NUL
 | |
| )
 | |
| msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
 | |
| 
 | |
| if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
 | |
| if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
 | |
| if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
 | |
| goto :done
 | |
| 
 | |
| :vmware
 | |
| 
 | |
| if exist "C:\Users\vagrant\windows.iso" (
 | |
|     move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
 | |
| )
 | |
| 
 | |
| if not exist "C:\Windows\Temp\windows.iso" (
 | |
|     powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/14.1.2/8497320/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
 | |
|     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"
 | |
|     rd /S /Q "C:\Program Files (x86)\VMWare"
 | |
| )
 | |
| 
 | |
| cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
 | |
| cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"
 | |
| 
 | |
| sc query vmtools > NUL
 | |
| IF ERRORLEVEL 1060 cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"
 | |
| sc query vmtools > NUL
 | |
| IF ERRORLEVEL 1060 ECHO "Unable to install VMware Tools." & exit /b 1
 | |
| 
 | |
| rd /Q "C:\Windows\Temp\vmware-tools.tar"
 | |
| rd /Q "C:\Windows\Temp\windows.iso"
 | |
| rd /S /Q "C:\Windows\Temp\VMware"
 | |
| goto :done
 | |
| 
 | |
| :virtualbox
 | |
| 
 | |
| 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" (
 | |
|     powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.2.10/VBoxGuestAdditions_5.2.10.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
 | |
| )
 | |
| 
 | |
| cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
 | |
| 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
 | |
| cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
 | |
| rd /S /Q "C:\Windows\Temp\virtualbox"
 | |
| goto :done
 | |
| 
 | |
| :parallels
 | |
| if exist "C:\Users\vagrant\prl-tools-win.iso" (
 | |
| 	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
 | |
| 	cmd /C "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
 | |
| 	rd /S /Q "C:\Windows\Temp\parallels"
 | |
| )
 | |
| 
 | |
| :done
 | |
| msiexec /qb /x C:\Windows\Temp\7z920-x64.msi
 | 
