Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore src
- name: Build
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,21 @@ To provision a domain account for the computer, you can use the following comman
djoin.exe /provision /domain domainname /machine machinename /savefile filename
```

### Specifying a computer name

When you provide a computer name using the [`-ComputerName`][] argument, the Answer File Generator
does not check whether that computer name is valid. Specifying an invalid computer name will cause
Windows setup to fail when applying the answer file. Make sure you follow the
[rules for computer names](https://learn.microsoft.com/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-computername)
when choosing a name.

If you do not specify a computer name, Windows will automatically choose one during installation.
In addition, you can also use the `#` character to generate a name containing a random number.

Every occurrence of `#` in the provided computer name will be replaced with a digit between 0 and 9
when generating the answer file. For example `PC-###` would be replaced with `PC-123` (or some
other random number).

## Using JSON to provide options

Because the large number of command line arguments may get unwieldy, the Answer File Generator
Expand All @@ -315,7 +330,7 @@ The core functionality for generating answer files is implemented in the

To build Answer File Generator, make sure you have the following installed:

- [Microsoft .Net 8.0 SDK](https://dotnet.microsoft.com/download) or later
- [Microsoft .Net 9.0 SDK](https://dotnet.microsoft.com/download) or later

To build the application, library, and tests, simply use the `dotnet build` command in the `src`
directory. You can run the unit tests using `dotnet test`.
Expand All @@ -338,6 +353,7 @@ any other adverse effects caused by the use of answer files generated by this to
[`-AutoLogonUser`]: doc/CommandLine.md#-autologonuser
[`-AutoLogonCount`]: doc/CommandLine.md#-autologoncount
[`-Feature`]: doc/CommandLine.md#-feature
[`-ComputerName`]: doc/CommandLine.md#-computername
[`-FirstLogonCommand`]: doc/CommandLine.md#-firstlogoncommand
[`-Install`]: doc/CommandLine.md#-install
[`-InstallToDisk`]: doc/CommandLine.md#-installtodisk
Expand Down
6 changes: 6 additions & 0 deletions doc/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# What's new in Answer File Generator

## Answer File Generator 2.1 (2025-03-09)

- You can now [generate computer names containing a random number](../README.md#specifying-a-computer-name),
by using the `#` character in the name you provide.
- Improved error messages for certain kinds of invalid JSON input.

## Answer File Generator 2.0 (2024-10-07)

- The [`-DomainAccount`][] argument now allows you to specify users from different domains than the
Expand Down
8 changes: 6 additions & 2 deletions doc/CommandLine.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,14 @@ Required argument: -JoinDomain

### `-ComputerName`

The network name for the computer. If not specified, Windows will generate a default name.
The network name for the computer. If not specified, Windows will generate a default name. Any `#`
characters in the name will be replaced with a random digit between 0 and 9. For example, `PC-###`
would be replaced with `PC-123` (or some other random number).

Must not be blank.

See [specifying a computer name](../README.md#specifying-a-computer-name).

```yaml
Value: <String>
Alias: -n
Expand Down Expand Up @@ -485,7 +489,7 @@ See [first log-on commands and scripts](../README.md#first-log-on-commands-and-s

```yaml
Value: <String> (multiple allowed)
Aliases: -SetupScript, -s
Alias: -s
```

### `-Language`
Expand Down
28 changes: 14 additions & 14 deletions doc/Library.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ Version 2.0 of the library has a few breaking changes from version 1.x:
- The [`DomainOptionsBase.DomainAccounts`][] property has a different type.
- The `AnswerFileOptions.SetupScripts` property was renamed to [`FirstLogonScripts`][].

[`AnswerFileGenerator.Generate`]: https://www.ookii.org/docs/answerfile-2.0/html/Overload_Ookii_AnswerFile_AnswerFileGenerator_Generate.htm
[`AnswerFileGenerator`]: https://www.ookii.org/docs/answerfile-2.0/html/T_Ookii_AnswerFile_AnswerFileGenerator.htm
[`AnswerFileOptions.DisplayResolution`]: https://www.ookii.org/docs/answerfile-2.0/html/P_Ookii_AnswerFile_AnswerFileOptions_DisplayResolution.htm
[`AnswerFileOptions.InstallOptions`]: https://www.ookii.org/docs/answerfile-2.0/html/P_Ookii_AnswerFile_AnswerFileOptions_InstallOptions.htm
[`AnswerFileOptions.JoinDomain`]: https://www.ookii.org/docs/answerfile-2.0/html/P_Ookii_AnswerFile_AnswerFileOptions_JoinDomain.htm
[`AnswerFileOptions`]: https://www.ookii.org/docs/answerfile-2.0/html/T_Ookii_AnswerFile_AnswerFileOptions.htm
[`CleanBiosOptions`]: https://www.ookii.org/docs/answerfile-2.0/html/T_Ookii_AnswerFile_CleanBiosOptions.htm
[`CleanEfiOptions`]: https://www.ookii.org/docs/answerfile-2.0/html/T_Ookii_AnswerFile_CleanEfiOptions.htm
[`DomainOptions`]: https://www.ookii.org/docs/answerfile-2.0/html/T_Ookii_AnswerFile_DomainOptions.htm
[`DomainOptionsBase.DomainAccounts`]: https://www.ookii.org/docs/answerfile-2.0/html/P_Ookii_AnswerFile_DomainOptionsBase_DomainAccounts.htm
[`DomainOptionsBase`]: https://www.ookii.org/docs/answerfile-2.0/html/T_Ookii_AnswerFile_DomainOptionsBase.htm
[`ExistingPartitionOptions`]: https://www.ookii.org/docs/answerfile-2.0/html/T_Ookii_AnswerFile_ExistingPartitionOptions.htm
[`FirstLogonScripts`]: https://www.ookii.org/docs/answerfile-2.0/html/P_Ookii_AnswerFile_AnswerFileOptions_FirstLogonScripts.htm
[`ManualInstallOptions`]: https://www.ookii.org/docs/answerfile-2.0/html/T_Ookii_AnswerFile_ManualInstallOptions.htm
[`AnswerFileGenerator.Generate`]: https://www.ookii.org/docs/answerfile-2.1/html/Overload_Ookii_AnswerFile_AnswerFileGenerator_Generate.htm
[`AnswerFileGenerator`]: https://www.ookii.org/docs/answerfile-2.1/html/T_Ookii_AnswerFile_AnswerFileGenerator.htm
[`AnswerFileOptions.DisplayResolution`]: https://www.ookii.org/docs/answerfile-2.1/html/P_Ookii_AnswerFile_AnswerFileOptions_DisplayResolution.htm
[`AnswerFileOptions.InstallOptions`]: https://www.ookii.org/docs/answerfile-2.1/html/P_Ookii_AnswerFile_AnswerFileOptions_InstallOptions.htm
[`AnswerFileOptions.JoinDomain`]: https://www.ookii.org/docs/answerfile-2.1/html/P_Ookii_AnswerFile_AnswerFileOptions_JoinDomain.htm
[`AnswerFileOptions`]: https://www.ookii.org/docs/answerfile-2.1/html/T_Ookii_AnswerFile_AnswerFileOptions.htm
[`CleanBiosOptions`]: https://www.ookii.org/docs/answerfile-2.1/html/T_Ookii_AnswerFile_CleanBiosOptions.htm
[`CleanEfiOptions`]: https://www.ookii.org/docs/answerfile-2.1/html/T_Ookii_AnswerFile_CleanEfiOptions.htm
[`DomainOptions`]: https://www.ookii.org/docs/answerfile-2.1/html/T_Ookii_AnswerFile_DomainOptions.htm
[`DomainOptionsBase.DomainAccounts`]: https://www.ookii.org/docs/answerfile-2.1/html/P_Ookii_AnswerFile_DomainOptionsBase_DomainAccounts.htm
[`DomainOptionsBase`]: https://www.ookii.org/docs/answerfile-2.1/html/T_Ookii_AnswerFile_DomainOptionsBase.htm
[`ExistingPartitionOptions`]: https://www.ookii.org/docs/answerfile-2.1/html/T_Ookii_AnswerFile_ExistingPartitionOptions.htm
[`FirstLogonScripts`]: https://www.ookii.org/docs/answerfile-2.1/html/P_Ookii_AnswerFile_AnswerFileOptions_FirstLogonScripts.htm
[`ManualInstallOptions`]: https://www.ookii.org/docs/answerfile-2.1/html/T_Ookii_AnswerFile_ManualInstallOptions.htm
2 changes: 1 addition & 1 deletion doc/Ookii.AnswerFile.shfbproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<IndentHtml>False</IndentHtml>
<BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>
<SaveComponentCacheCapacity>100</SaveComponentCacheCapacity>
<HelpTitle>Ookii.AnswerFile 2.0 Documentation</HelpTitle>
<HelpTitle>Ookii.AnswerFile 2.1 Documentation</HelpTitle>
<HelpFileVersion>1.0.0.0</HelpFileVersion>
<NamingMethod>MemberName</NamingMethod>
<ContentPlacement>AboveNamespaces</ContentPlacement>
Expand Down
2 changes: 1 addition & 1 deletion doc/refs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"#apiPrefix": "https://learn.microsoft.com/dotnet/api/",
"#prefix": "https://www.ookii.org/docs/answerfile-2.0/html/",
"#prefix": "https://www.ookii.org/docs/answerfile-2.1/html/",
"#suffix": ".htm",
"AnswerFileGenerator": "T_Ookii_AnswerFile_AnswerFileGenerator",
"AnswerFileGenerator.Generate": "Overload_Ookii_AnswerFile_AnswerFileGenerator_Generate",
Expand Down
Loading