1 | @echo off
|
---|
2 | rem $Id: win_postinstall.cmd 84875 2020-06-19 05:45:20Z vboxsync $
|
---|
3 | rem rem @file
|
---|
4 | rem Post installation script template for Windows.
|
---|
5 | rem
|
---|
6 | rem This runs after the target system has been booted, typically as
|
---|
7 | rem part of the first logon.
|
---|
8 | rem
|
---|
9 |
|
---|
10 | rem
|
---|
11 | rem Copyright (C) 2017-2020 Oracle Corporation
|
---|
12 | rem
|
---|
13 | rem This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
14 | rem available from http://www.virtualbox.org. This file is free software;
|
---|
15 | rem you can redistribute it and/or modify it under the terms of the GNU
|
---|
16 | rem General Public License (GPL) as published by the Free Software
|
---|
17 | rem Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
18 | rem VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
19 | rem hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
20 | rem
|
---|
21 |
|
---|
22 | rem Globals.
|
---|
23 | set MY_LOG_FILE=C:\vboxpostinstall.log
|
---|
24 |
|
---|
25 | rem Log header.
|
---|
26 | echo *** started >> %MY_LOG_FILE%
|
---|
27 | echo *** CD=%CD% >> %MY_LOG_FILE%
|
---|
28 | echo *** Environment BEGIN >> %MY_LOG_FILE%
|
---|
29 | set >> %MY_LOG_FILE%
|
---|
30 | echo *** Environment END >> %MY_LOG_FILE%
|
---|
31 |
|
---|
32 | @@VBOX_COND_HAS_PROXY@@
|
---|
33 | set PROXY=@@VBOX_INSERT_PROXY@@
|
---|
34 | set HTTP_PROXY=%PROXY%
|
---|
35 | set HTTPS_PROXY=%PROXY%
|
---|
36 | echo HTTP proxy is %HTTP_PROXY% >> %MY_LOG_FILE%
|
---|
37 | echo HTTPS proxy is %HTTPS_PROXY% >> %MY_LOG_FILE%
|
---|
38 | @@VBOX_COND_END@@
|
---|
39 |
|
---|
40 | @@VBOX_COND_IS_INSTALLING_ADDITIONS@@
|
---|
41 | rem
|
---|
42 | rem Install the guest additions.
|
---|
43 | rem
|
---|
44 |
|
---|
45 | rem First find the CDROM with the GAs on them.
|
---|
46 | set MY_VBOX_ADDITIONS=E:\vboxadditions
|
---|
47 | if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
|
---|
48 | set MY_VBOX_ADDITIONS=D:\vboxadditions
|
---|
49 | if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
|
---|
50 | set MY_VBOX_ADDITIONS=F:\vboxadditions
|
---|
51 | if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
|
---|
52 | set MY_VBOX_ADDITIONS=G:\vboxadditions
|
---|
53 | if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
|
---|
54 | set MY_VBOX_ADDITIONS=E:
|
---|
55 | if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
|
---|
56 | set MY_VBOX_ADDITIONS=F:
|
---|
57 | if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
|
---|
58 | set MY_VBOX_ADDITIONS=G:
|
---|
59 | if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
|
---|
60 | set MY_VBOX_ADDITIONS=D:
|
---|
61 | if exist %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe goto found_vbox_additions
|
---|
62 | set MY_VBOX_ADDITIONS=E:\vboxadditions
|
---|
63 | :found_vbox_additions
|
---|
64 | echo *** MY_VBOX_ADDITIONS=%MY_VBOX_ADDITIONS%\ >> %MY_LOG_FILE%
|
---|
65 |
|
---|
66 | rem Then add signing certificate to trusted publishers
|
---|
67 | echo *** Running: %MY_VBOX_ADDITIONS%\cert\VBoxCertUtil.exe ... >> %MY_LOG_FILE%
|
---|
68 | %MY_VBOX_ADDITIONS%\cert\VBoxCertUtil.exe add-trusted-publisher %MY_VBOX_ADDITIONS%\cert\vbox*.cer --root %MY_VBOX_ADDITIONS%\cert\vbox*.cer >> %MY_LOG_FILE% 2>&1
|
---|
69 | echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
|
---|
70 |
|
---|
71 | rem Then do the installation.
|
---|
72 | echo *** Running: %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe /S >> %MY_LOG_FILE%
|
---|
73 | %MY_VBOX_ADDITIONS%\VBoxWindowsAdditions.exe /S
|
---|
74 | echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
|
---|
75 |
|
---|
76 | @@VBOX_COND_END@@
|
---|
77 |
|
---|
78 |
|
---|
79 | @@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@
|
---|
80 | rem
|
---|
81 | rem Install the Test Execution service
|
---|
82 | rem
|
---|
83 |
|
---|
84 | rem First find the CDROM with the validation kit on it.
|
---|
85 | set MY_VBOX_VALIDATION_KIT=E:\vboxvalidationkit
|
---|
86 | if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
|
---|
87 | set MY_VBOX_VALIDATION_KIT=D:\vboxvalidationkit
|
---|
88 | if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
|
---|
89 | set MY_VBOX_VALIDATION_KIT=F:\vboxvalidationkit
|
---|
90 | if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
|
---|
91 | set MY_VBOX_VALIDATION_KIT=G:\vboxvalidationkit
|
---|
92 | if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
|
---|
93 | set MY_VBOX_VALIDATION_KIT=E:
|
---|
94 | if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
|
---|
95 | set MY_VBOX_VALIDATION_KIT=F:
|
---|
96 | if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
|
---|
97 | set MY_VBOX_VALIDATION_KIT=G:
|
---|
98 | if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
|
---|
99 | set MY_VBOX_VALIDATION_KIT=D:
|
---|
100 | if exist %MY_VBOX_VALIDATION_KIT%\vboxtxs-readme.txt goto found_vbox_validation_kit
|
---|
101 | set MY_VBOX_VALIDATION_KIT=E:\vboxvalidationkit
|
---|
102 | :found_vbox_validation_kit
|
---|
103 | echo *** MY_VBOX_VALIDATION_KIT=%MY_VBOX_VALIDATION_KIT%\ >> %MY_LOG_FILE%
|
---|
104 |
|
---|
105 | rem Copy over the files.
|
---|
106 | echo *** Running: mkdir %SystemDrive%\Apps >> %MY_LOG_FILE%
|
---|
107 | mkdir %SystemDrive%\Apps >> %MY_LOG_FILE% 2>&1
|
---|
108 | echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
|
---|
109 |
|
---|
110 | echo *** Running: copy %MY_VBOX_VALIDATION_KIT%\win\* %SystemDrive%\Apps >> %MY_LOG_FILE%
|
---|
111 | copy %MY_VBOX_VALIDATION_KIT%\win\* %SystemDrive%\Apps >> %MY_LOG_FILE% 2>&1
|
---|
112 | echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
|
---|
113 |
|
---|
114 | echo *** Running: copy %MY_VBOX_VALIDATION_KIT%\win\%PROCESSOR_ARCHITECTURE%\* %SystemDrive%\Apps >> %MY_LOG_FILE%
|
---|
115 | copy %MY_VBOX_VALIDATION_KIT%\win\%PROCESSOR_ARCHITECTURE%\* %SystemDrive%\Apps >> %MY_LOG_FILE% 2>&1
|
---|
116 | echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
|
---|
117 |
|
---|
118 | rem Update the registry to autorun the service and make sure we've got autologon.
|
---|
119 | echo *** Running: reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v NTConfiguration /d %SystemDrive%\Apps\vboxtxs.cmd >> %MY_LOG_FILE%
|
---|
120 | reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v NTConfiguration /d %SystemDrive%\Apps\vboxtxs.cmd >> %MY_LOG_FILE% 2>&1
|
---|
121 | echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
|
---|
122 |
|
---|
123 | echo *** Running: reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon /v PowerdownAfterShutdown /d 1 >> %MY_LOG_FILE%
|
---|
124 | reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon /v PowerdownAfterShutdown /d 1 >> %MY_LOG_FILE% 2>&1
|
---|
125 | echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
|
---|
126 |
|
---|
127 | echo *** Running: reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon /v ForceAutoLogon /d 1 >> %MY_LOG_FILE%
|
---|
128 | reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon /v ForceAutoLogon /d 1 >> %MY_LOG_FILE% 2>&1
|
---|
129 | echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
|
---|
130 | rem AutoAdminLogon too if administrator?
|
---|
131 |
|
---|
132 | rem Configure the firewall to allow TXS to listen.
|
---|
133 | echo *** Running: netsh firewall add portopening TCP 5048 "TestExecService 5048" >> %MY_LOG_FILE%
|
---|
134 | netsh firewall add portopening TCP 5048 "TestExecService 5048" >> %MY_LOG_FILE% 2>&1
|
---|
135 | echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
|
---|
136 |
|
---|
137 | echo *** Running: netsh firewall add portopening TCP 5042 "TestExecService 5042" >> %MY_LOG_FILE%
|
---|
138 | netsh firewall add portopening TCP 5042 "TestExecService 5042" >> %MY_LOG_FILE% 2>&1
|
---|
139 | echo *** ERRORLEVEL: %ERRORLEVEL% >> %MY_LOG_FILE%
|
---|
140 |
|
---|
141 | @@VBOX_COND_END@@
|
---|
142 |
|
---|
143 |
|
---|
144 | @@VBOX_COND_HAS_POST_INSTALL_COMMAND@@
|
---|
145 | rem
|
---|
146 | rem Run user command.
|
---|
147 | rem
|
---|
148 | echo *** Running custom user command ... >> %MY_LOG_FILE%
|
---|
149 | echo *** Running: "@@VBOX_INSERT_POST_INSTALL_COMMAND@@" >> %MY_LOG_FILE%
|
---|
150 | @@VBOX_INSERT_POST_INSTALL_COMMAND@@
|
---|
151 | @@VBOX_COND_END@@
|
---|
152 |
|
---|
153 | echo *** done >> %MY_LOG_FILE%
|
---|
154 |
|
---|