Skip to content

Commit 13c74f3

Browse files
committed
Proofread the readme.
1 parent a43e5f8 commit 13c74f3

File tree

1 file changed

+48
-28
lines changed

1 file changed

+48
-28
lines changed

README.md

Lines changed: 48 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Windows Answer File Generator
22

33
The Answer File Generator is a command line application and library for generating answer files for
4-
unattended Windows installations. This file is commonly called unattend.xml or autounattend.xml
4+
unattended Windows installations. These files are commonly called unattend.xml or autounattend.xml
55
(depending on the installation method used).
66

7-
This tool can be used to generate answer files as part of an automated workflow for installation
8-
Windows, or just as a convenient way to generate answer files for personal use that doesn't require
9-
installing the Windows System Image Manager, or manually editing XML files.
7+
This tool can be used to generate answer files as part of an automated workflow for installing
8+
Windows, or just as a convenient way to generate answer files for personal use, without the need to
9+
install the Windows System Image Manager, or manually edit XML files.
1010

1111
Answer files can customize many aspects of the Windows installation, only some of which are
12-
available through this tool. Elements supported by the Answer File Generator include:
12+
available through this tool. Customizations supported by the Answer File Generator include:
1313

1414
- The installation method and target disk and partition.
1515
- Enabling optional features during installation.
@@ -25,38 +25,39 @@ available through this tool. Elements supported by the Answer File Generator inc
2525
All of these items can be customized using command line arguments. In addition, the answer files
2626
generated here will always skip the entire OOBE experience unless no local account was created.
2727

28-
If you need additional customization, you will need to edit the generated unattend.xml file. If
29-
you'd like any other options to be available through the tool, you can file an issue or submit a
30-
pull request.
31-
3228
For a full list of command line arguments, run `./GenerateAnswerFile -Help`.
3329

30+
If you need additional customization, you will need to edit the generated unattend.xml file. If
31+
you'd like any other options to be available through the tool, you can
32+
[file an issue](https://github.com/SvenGroot/GenerateAnswerFile/issues) or
33+
[submit a pull request](https://github.com/SvenGroot/GenerateAnswerFile/pulls).
34+
3435
## Installation method
3536

3637
The Answer File Generator supports several methods of installing Windows, which are specified using
3738
the `-Install` argument. The following values are supported.
3839

3940
Method | Description
4041
----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
41-
**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.
4243
**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.
4344
**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.
4445
**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.
4546
**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.
4647

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
4950
one-based instead (don't look at me; that's how the IDs work in the answer file).
5051

5152
## Selecting the edition to install
5253

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.
5859

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
6061
require a product key in the answer file. In this case, if the installation media holds multiple
6162
editions, you can select the desired one using the `-ImageIndex` argument. You can use the
6263
[`Get-WindowsImage`](https://learn.microsoft.com/powershell/module/dism/get-windowsimage) PowerShell
@@ -71,7 +72,7 @@ of the account that will be logged on.
7172

7273
:warning: **Passwords in answer files are not securely stored** :warning:
7374

74-
They are at best base64-encoded (which is easily reversible), and at worse just stored in plain
75+
They are at best base64-encoded (which is easily reversible), and at worst just stored in plain
7576
text. Do not store answer files with sensitive passwords in unsecure locations, and delete such
7677
files when you are done with them.
7778

@@ -111,10 +112,10 @@ By default, the generated answer files are for 64 bit (amd64) editions of Window
111112
```
112113

113114
This creates a user named "John" with the password "Password" (don't do this, obviously), and logs
114-
in with that user automatically on first boot. To log in automatically more than once, use the
115+
in with that user automatically on first boot[^1]. To log in automatically more often, use the
115116
`-AutoLogonCount` argument.
116117

117-
The `-LocalAccount` argument takes multiple values if you want to create more than one account.
118+
The `-LocalAccount` argument takes multiple values, if you want to create more than one account.
118119

119120
### Joining a domain
120121

@@ -124,7 +125,7 @@ The `-LocalAccount` argument takes multiple values if you want to create more th
124125

125126
This answer file sets the computer name to "my-pc" and joins it to the domain "mydomain" using the
126127
supplied credentials. It also adds the account "domainuser" to the local administrators group and
127-
logs in using that account automatically on first boot.
128+
logs in using that account automatically on first boot[^1].
128129

129130
This sample does not use the `-Install` argument, so it creates an answer file suitable for
130131
pre-installed Windows images, such as those created using sysprep. The `-JoinDomain` argument can
@@ -133,7 +134,7 @@ be used with any install method, however.
133134
### Optional features
134135

135136
Answer files can be used to enable optional features during installation. To do this, use the
136-
`-Feature` argument. This argument takes multiple values to enable multiple features.
137+
`-Feature` argument. This argument can take multiple values to enable multiple features.
137138

138139
```text
139140
./GenerateAnswerFile autounattend.xml -Install CleanEfi -Feature Microsoft-Windows-Subsystem-Linux VirtualMachinePlatform -WindowsVersion 10.0.22621.1
@@ -145,26 +146,45 @@ When using optional features, the answer file must contain the exact version num
145146
version being installed, such as "10.0.22621.1" (this is the version for Windows 11 22h2). You must
146147
specify this version using the `-WindowsVersion` argument. To find out the exact version number, the
147148
easiest way is to look at the file properties of the setup.exe file on your Windows installation
148-
media.
149+
media. The Windows version is not needed if you don't enable any optional components.
149150

150151
To determine the names of available optional features, you can use the
151152
[`Get-WindowsOptionalFeature`](https://learn.microsoft.com/powershell/module/dism/get-windowsoptionalfeature)
152153
PowerShell command.
153154

155+
### First log-on scripts
156+
157+
```text
158+
./GenerateAnswerFile autounattend.xml -Install CleanEfi -SetupScript "\\server\share\script.ps1 -Argument" -LocalAccount John,Password -AutoLogonUser John -AutoLogonPassword Password -ProductKey ABCDE-12345-ABCDE-12345-ABCDE
159+
```
160+
161+
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+
154172
## Using an answer file
155173

156174
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.
157175

158-
## Ookii.AnswerFile library [![NuGet](https://img.shields.io/nuget/v/Ookii.AnswerFile)](https://www.nuget.org/packages/Ookii.AnswerFile/)
176+
## Ookii.AnswerFile library
159177

160178
The core functionality for generating answer files is implemented in the Ookii.AnswerFile library,
161179
which you can use in your own applications targeting .Net 7.0 or later.
162180

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 ![NuGet](https://img.shields.io/nuget/v/Ookii.AnswerFile)](https://nuget.org/packages/Ookii.AnswerFile).
182+
For more information, check out the [class library documentation](https://www.ookii.org/Link/GenerateAnswerFileDoc).
165183

166184
## Disclaimer
167185

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
169187
or partition on your system without user intervention. I am not responsible for any loss of data or
170188
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

Comments
 (0)