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
5 changes: 5 additions & 0 deletions doc/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# What's new in Answer File Generator

## Answer File Generator 2.2 (2025-05-08)

- Add an option to specify a password for the built-in local Administrator account. This account is
disabled if no password is provided.

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

- You can now [generate computer names containing a random number](../README.md#specifying-a-computer-name),
Expand Down
11 changes: 11 additions & 0 deletions doc/CommandLine.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ The arguments are split into several categories:
<!-- markdownlint-disable MD033 -->
<pre>GenerateAnswerFile
[[<a href="#-outputfile">-OutputFile</a>] &lt;Path&gt;]
[<a href="#-administratorpassword">-AdministratorPassword</a> &lt;String&gt;]
[<a href="#-autologoncount">-AutoLogonCount</a> &lt;Number&gt;]
[<a href="#-autologonpassword">-AutoLogonPassword</a> &lt;String&gt;]
[<a href="#-autologonuser">-AutoLogonUser</a> &lt;[Domain\]User&gt;]
Expand Down Expand Up @@ -250,6 +251,16 @@ Alias: -v

## User account options

### `-AdministratorPassword`

The password to use for the built-in local Administrator account. If not specified, the
Administrator account will be disabled by default.

```yaml
Value: <String>
Alias: -ap
```

### `-AutoLogonCount`

The number of times the user specified by [`-AutoLogonUser`](#-autologonuser) will be automatically
Expand Down
2 changes: 1 addition & 1 deletion doc/Json.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ this:

```json
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"InstallOptions": {
"$type": "CleanEfi"
},
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.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
[`AnswerFileGenerator.Generate`]: https://www.ookii.org/docs/answerfile-2.2/html/Overload_Ookii_AnswerFile_AnswerFileGenerator_Generate.htm
[`AnswerFileGenerator`]: https://www.ookii.org/docs/answerfile-2.2/html/T_Ookii_AnswerFile_AnswerFileGenerator.htm
[`AnswerFileOptions.DisplayResolution`]: https://www.ookii.org/docs/answerfile-2.2/html/P_Ookii_AnswerFile_AnswerFileOptions_DisplayResolution.htm
[`AnswerFileOptions.InstallOptions`]: https://www.ookii.org/docs/answerfile-2.2/html/P_Ookii_AnswerFile_AnswerFileOptions_InstallOptions.htm
[`AnswerFileOptions.JoinDomain`]: https://www.ookii.org/docs/answerfile-2.2/html/P_Ookii_AnswerFile_AnswerFileOptions_JoinDomain.htm
[`AnswerFileOptions`]: https://www.ookii.org/docs/answerfile-2.2/html/T_Ookii_AnswerFile_AnswerFileOptions.htm
[`CleanBiosOptions`]: https://www.ookii.org/docs/answerfile-2.2/html/T_Ookii_AnswerFile_CleanBiosOptions.htm
[`CleanEfiOptions`]: https://www.ookii.org/docs/answerfile-2.2/html/T_Ookii_AnswerFile_CleanEfiOptions.htm
[`DomainOptions`]: https://www.ookii.org/docs/answerfile-2.2/html/T_Ookii_AnswerFile_DomainOptions.htm
[`DomainOptionsBase.DomainAccounts`]: https://www.ookii.org/docs/answerfile-2.2/html/P_Ookii_AnswerFile_DomainOptionsBase_DomainAccounts.htm
[`DomainOptionsBase`]: https://www.ookii.org/docs/answerfile-2.2/html/T_Ookii_AnswerFile_DomainOptionsBase.htm
[`ExistingPartitionOptions`]: https://www.ookii.org/docs/answerfile-2.2/html/T_Ookii_AnswerFile_ExistingPartitionOptions.htm
[`FirstLogonScripts`]: https://www.ookii.org/docs/answerfile-2.2/html/P_Ookii_AnswerFile_AnswerFileOptions_FirstLogonScripts.htm
[`ManualInstallOptions`]: https://www.ookii.org/docs/answerfile-2.2/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.1 Documentation</HelpTitle>
<HelpTitle>Ookii.AnswerFile 2.2 Documentation</HelpTitle>
<HelpFileVersion>1.0.0.0</HelpFileVersion>
<NamingMethod>MemberName</NamingMethod>
<ContentPlacement>AboveNamespaces</ContentPlacement>
Expand Down
2 changes: 1 addition & 1 deletion doc/json/cleanbios.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"InstallOptions": {
"$type": "CleanBios",
"ImageIndex": 1
Expand Down
2 changes: 1 addition & 1 deletion doc/json/cleanefi.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"InstallOptions": {
"$type": "CleanEfi",
"Partitions": [
Expand Down
2 changes: 1 addition & 1 deletion doc/json/existingpartition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"InstallOptions": {
"$type": "ExistingPartition",
"TargetPartitionId": 5,
Expand Down
2 changes: 1 addition & 1 deletion doc/json/manual.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"InstallOptions": {
"$type": "Manual",
"OptionalFeatures": {
Expand Down
2 changes: 1 addition & 1 deletion doc/json/preinstalled.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"JoinDomain": {
"$type": "Credential",
"Domain": "mydomain",
Expand Down
7 changes: 7 additions & 0 deletions doc/json/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@
}
]
},
"AdministratorPassword": {
"type": [
"null",
"string"
],
"description": "The password for the built-in local Administrator account, or null to leave the account disabled. Setting this to an empty string will enable the account without a password."
},
"DisplayResolution": {
"description": "The display resolution, in the format 'width,height' (e.g. '1920,1080'), or null to let Windows determine the default resolution.",
"type": [
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.1/html/",
"#prefix": "https://www.ookii.org/docs/answerfile-2.2/html/",
"#suffix": ".htm",
"AnswerFileGenerator": "T_Ookii_AnswerFile_AnswerFileGenerator",
"AnswerFileGenerator.Generate": "Overload_Ookii_AnswerFile_AnswerFileGenerator_Generate",
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<Authors>Sven Groot</Authors>
<Company>Ookii.org</Company>
<Copyright>Copyright (c) Sven Groot (Ookii.org)</Copyright>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
</PropertyGroup>
</Project>
8 changes: 8 additions & 0 deletions src/GenerateAnswerFile/Arguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ partial class Arguments : BaseArguments
[ValidateRange(1, null)]
public int AutoLogonCount { get; set; } = 1;

// This argument is deliberately allowed to be an empty string as that enables the account with
// no password.
[CommandLineArgument(Category = ArgumentCategory.UserAccounts)]
[ResourceDescription(nameof(Properties.Resources.AdministratorPasswordDescription))]
[Alias("ap")]
public string? AdministratorPassword { get; set; }

#endregion

#region Domain options
Expand Down Expand Up @@ -261,6 +268,7 @@ public AnswerFileOptions ToOptions()
ProductKey = ProductKey,
ProcessorArchitecture = ProcessorArchitecture,
TimeZone = TimeZone,
AdministratorPassword = AdministratorPassword,
};

if (LocalAccounts != null)
Expand Down
9 changes: 9 additions & 0 deletions src/GenerateAnswerFile/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/GenerateAnswerFile/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,7 @@ For more information, as well as usage examples, run '{0} -OnlineHelp', or see:
<data name="JoinDomainOfflineDescription" xml:space="preserve">
<value>Join the domain during the offlineServicing pass of Windows setup, rather than the specialize pass.</value>
</data>
<data name="AdministratorPasswordDescription" xml:space="preserve">
<value>The password to use for the built-in local Administrator account. If not specified, the Administrator account will be disabled by default.</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"InstallOptions": {
"$type": "CleanBios",
"Partitions": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"InstallOptions": {
"$type": "CleanEfi",
"Partitions": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"InstallOptions": {
"$type": "ExistingPartition",
"TargetPartitionId": 5,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"InstallOptions": {
"$type": "Manual",
"OptionalFeatures": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0",
"$schema": "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2",
"JoinDomain": {
"$type": "Credential",
"Domain": "domain",
Expand Down
15 changes: 9 additions & 6 deletions src/Ookii.AnswerFile/AnswerFileOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public partial class AnswerFileOptions
// This must be the first property and must not be static, so ToJson will insert the $schema
// property into the output.
[JsonPropertyName("$schema")]
public string JsonSchema => "https://www.ookii.org/Link/AnswerFileJsonSchema-2.0";
public string JsonSchema => "https://www.ookii.org/Link/AnswerFileJsonSchema-2.2";

/// <summary>
/// Gets or sets the installation method to use, along with the options for that method.
Expand Down Expand Up @@ -167,17 +167,19 @@ public Collection<LocalCredential> LocalAccounts
get => _localAccounts ??= new();
set => _localAccounts = value;
}

/// <summary>
/// Gets or sets the administrator password for the system.
/// Gets or sets the password for the local Administrator account.
/// </summary>
/// <value>
/// The password for the administrator account, or <see langword="null"/> if no password is to be set.
/// The default value is <see langword="null"/>.
/// The password for the administrator account, or <see langword="null"/> to leave the account
/// disabled. The default value is <see langword="null"/>.
/// </value>
/// <remarks>
/// <para>
/// This password will be applied to the default administrator account during the Windows setup.
/// This password will be applied to the built-in local Administrator account. If this
/// property is <see langword="null"/>, this account is disabled by default. If this property
/// is set to an empty string, the account will be enabled with no password.
/// </para>
/// <note type="security">
/// The password is stored using base64 encoding in the answer file; it is not encrypted.
Expand All @@ -192,6 +194,7 @@ public Collection<LocalCredential> LocalAccounts
/// </summary>
/// <value>
/// An instance of the <see cref="AutoLogonOptions"/> class, or <see langword="null"/> to not
/// An instance of the <see cref="AutoLogonOptions"/> class, or <see langword="null"/> to not
/// use automatic log-on. The default value is <see langword="null"/>.
/// </value>
/// <remarks>
Expand Down
2 changes: 1 addition & 1 deletion src/Ookii.AnswerFile/Ookii.AnswerFile.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<ItemGroup>
<PackageReference Include="Ookii.BinarySize" Version="1.2.0" />
<PackageReference Include="System.Text.Json" Version="9.0.2" Condition="'$(TargetFramework)'=='net8.0'" />
<PackageReference Include="System.Text.Json" Version="9.0.4" Condition="'$(TargetFramework)'=='net8.0'" />
</ItemGroup>

<ItemGroup>
Expand Down