You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**PreInstalled** | This is the default method, which is used to customize an already installed Windows image, such as one created using sysprep. Some features are unavailable using this method, including installation of optional features.
42
+
**PreInstalled** | This is the default method, which is used to customize an already installed Windows image, such as one created using sysprep, or an image that was manually expanded using DISM tools such as [`Expand-WindowsImage`](https://learn.microsoft.com/powershell/module/dism/expand-windowsimage). Some features are unavailable using this method, including installation of optional features.
42
43
**CleanEfi** | Performs a clean installation for systems using UEFI on the disk indicated by the `-InstallToDisk` argument. This disk will be repartitioned using a partition scheme that's appropriate for UEFI systems, with a 100MB EFI partition, a 128MB MSR partition, and the remainder of the disk used for the OS installation.
43
44
**CleanBios** | Performs a clean installation for systems using legacy BIOS on the disk indicated by the `-InstallToDisk` argument. This disk will be repartitioned using a partition scheme that's appropriate for BIOS systems, with a 100MB system partition, and the remainder of the disk used for the OS installation.
44
45
**ExistingPartition** | Installs Windows to an existing partition, specified using the `-InstallToDisk` and `-InstallToPartition` arguments. This partition will be formatted before installation, but other partitions are not touched. The system must already have a suitable system or EFI partition.
45
46
**Manual** | Allows the user to specify the target disk/partition during setup. When using this method, installation is not fully unattended and will require user intervention during the first stage.
46
47
47
-
The `-InstallToDisk`parameter takes the zero-based disk index, in the order that the Windows
48
-
installation (when executed manually) would list them. The `-InstallToPartition`parameter is
48
+
The `-InstallToDisk`argument takes the zero-based disk index, in the order that the Windows
49
+
installation (when executed manually) would list them. The `-InstallToPartition`argument is
49
50
one-based instead (don't look at me; that's how the IDs work in the answer file).
50
51
51
52
## Selecting the edition to install
52
53
53
-
Usually, Windows installation media can be used to install multiple editions, such as Professional
54
-
or Home, and you must select which edition to install. The most common way to do this is using the
55
-
product key, which can be set using the `-ProductKey` argument. Setting the product key will select
56
-
the correct edition to install, and activate Windows using that key. Setting a product key in an
57
-
answer file is required for most installations of Windows.
54
+
Usually, Windows installation media contains multiple editions, such as Professional or Home, and
55
+
you must select which edition to install. The most common way to do this is using the product key,
56
+
which can be set using the `-ProductKey` argument. Setting the product key will select the correct
57
+
edition to install, and activate Windows using that key. Setting a product key in an answer file is
58
+
required for most installations of Windows.
58
59
59
-
Versions of Windows that do not use product keys, such as versions using volume licensing, do not
60
+
Versions of Windows that use alternative activation methods, such as volume licensing, do not
60
61
require a product key in the answer file. In this case, if the installation media holds multiple
61
62
editions, you can select the desired one using the `-ImageIndex` argument. You can use the
The `-SetupScript` argument can be used to specify one or more PowerShell scripts to execute during
162
+
first log-on. This argument can take multiple values to specify multiple scripts, which will be
163
+
executed in the order they are supplied. The argument value may include script arguments.
164
+
165
+
Scripts specified with this argument are executed with PowerShell.exe, so must always be
166
+
Windows PowerShell scripts. If at least one setup script is used, the answer file will also contain
167
+
commands to set the PowerShell execution policy to enable script execution.
168
+
169
+
The scripts must be stored in a location that is accessible to the system after installation, such
170
+
as a network share like the example above.
171
+
154
172
## Using an answer file
155
173
156
174
Please refer to the [official Microsoft documentation](https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-automation-overview) to see how to use an answer file during Windows setup.
The core functionality for generating answer files is implemented in the Ookii.AnswerFile library,
161
179
which you can use in your own applications targeting .Net 7.0 or later.
162
180
163
-
The library is available on [NuGet](https://nuget.org/packages/Ookii.AnswerFile). For more
164
-
information, check out the [class library documentation](https://www.ookii.org/Link/GenerateAnswerFileDoc).
181
+
The library is available on [NuGet](https://nuget.org/packages/Ookii.AnswerFile).
182
+
For more information, check out the [class library documentation](https://www.ookii.org/Link/GenerateAnswerFileDoc).
165
183
166
184
## Disclaimer
167
185
168
-
The Answer File Generator will generated files that, when used to install Windows, can erase a disk
186
+
The Answer File Generator will generate files that, when used to install Windows, can erase a disk
169
187
or partition on your system without user intervention. I am not responsible for any loss of data or
170
188
any other adverse effects caused by the use of answer files generated by this tool.
189
+
190
+
[^1]: Automatic log-on will actually occur twice, due to a [known issue with the `LogonCount` element](https://learn.microsoft.com/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-autologon-logoncount).
0 commit comments