diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index 1c49f7f..993e226 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -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), diff --git a/doc/CommandLine.md b/doc/CommandLine.md index 10063ef..dec38d7 100644 --- a/doc/CommandLine.md +++ b/doc/CommandLine.md @@ -51,6 +51,7 @@ The arguments are split into several categories:
GenerateAnswerFile
     [[-OutputFile] <Path>]
+    [-AdministratorPassword <String>]
     [-AutoLogonCount <Number>]
     [-AutoLogonPassword <String>]
     [-AutoLogonUser <[Domain\]User>]
@@ -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: 
+Alias: -ap
+```
+
 ### `-AutoLogonCount`
 
 The number of times the user specified by [`-AutoLogonUser`](#-autologonuser) will be automatically
diff --git a/doc/Json.md b/doc/Json.md
index 8d721b0..6b3e33f 100644
--- a/doc/Json.md
+++ b/doc/Json.md
@@ -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"
     },
diff --git a/doc/Library.md b/doc/Library.md
index ce5fcf5..845dca4 100644
--- a/doc/Library.md
+++ b/doc/Library.md
@@ -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
diff --git a/doc/Ookii.AnswerFile.shfbproj b/doc/Ookii.AnswerFile.shfbproj
index 332aacb..3f1eefd 100644
--- a/doc/Ookii.AnswerFile.shfbproj
+++ b/doc/Ookii.AnswerFile.shfbproj
@@ -54,7 +54,7 @@
     False
     OnlyWarningsAndErrors
     100
-    Ookii.AnswerFile 2.1 Documentation
+    Ookii.AnswerFile 2.2 Documentation
     1.0.0.0
     MemberName
     AboveNamespaces
diff --git a/doc/json/cleanbios.json b/doc/json/cleanbios.json
index cd0a01e..90f27bb 100644
--- a/doc/json/cleanbios.json
+++ b/doc/json/cleanbios.json
@@ -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
diff --git a/doc/json/cleanefi.json b/doc/json/cleanefi.json
index 1549138..60ef9fe 100644
--- a/doc/json/cleanefi.json
+++ b/doc/json/cleanefi.json
@@ -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": [
diff --git a/doc/json/existingpartition.json b/doc/json/existingpartition.json
index a1b7bcd..9724eeb 100644
--- a/doc/json/existingpartition.json
+++ b/doc/json/existingpartition.json
@@ -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,
diff --git a/doc/json/manual.json b/doc/json/manual.json
index 7112318..d9c8fd1 100644
--- a/doc/json/manual.json
+++ b/doc/json/manual.json
@@ -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": {
diff --git a/doc/json/preinstalled.json b/doc/json/preinstalled.json
index 0493cd4..bf4f510 100644
--- a/doc/json/preinstalled.json
+++ b/doc/json/preinstalled.json
@@ -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",
diff --git a/doc/json/schema.json b/doc/json/schema.json
index 70b4e36..9b6c369 100644
--- a/doc/json/schema.json
+++ b/doc/json/schema.json
@@ -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": [
diff --git a/doc/refs.json b/doc/refs.json
index b6e692f..77fe633 100644
--- a/doc/refs.json
+++ b/doc/refs.json
@@ -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",
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 1261e04..763130a 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -4,6 +4,6 @@
     Sven Groot
     Ookii.org
     Copyright (c) Sven Groot (Ookii.org)
-    2.1.0
+    2.2.0
   
 
\ No newline at end of file
diff --git a/src/GenerateAnswerFile/Arguments.cs b/src/GenerateAnswerFile/Arguments.cs
index c9ba7ca..26b218e 100644
--- a/src/GenerateAnswerFile/Arguments.cs
+++ b/src/GenerateAnswerFile/Arguments.cs
@@ -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
@@ -261,6 +268,7 @@ public AnswerFileOptions ToOptions()
             ProductKey = ProductKey,
             ProcessorArchitecture = ProcessorArchitecture,
             TimeZone = TimeZone,
+            AdministratorPassword = AdministratorPassword,
         };
 
         if (LocalAccounts != null)
diff --git a/src/GenerateAnswerFile/Properties/Resources.Designer.cs b/src/GenerateAnswerFile/Properties/Resources.Designer.cs
index 7fb49a3..8797795 100644
--- a/src/GenerateAnswerFile/Properties/Resources.Designer.cs
+++ b/src/GenerateAnswerFile/Properties/Resources.Designer.cs
@@ -60,6 +60,15 @@ internal Resources() {
             }
         }
         
+        /// 
+        ///   Looks up a localized string similar to The password to use for the built-in local Administrator account. If not specified, the Administrator account will be disabled by default..
+        /// 
+        internal static string AdministratorPasswordDescription {
+            get {
+                return ResourceManager.GetString("AdministratorPasswordDescription", resourceCulture);
+            }
+        }
+        
         /// 
         ///   Looks up a localized string similar to Generates answer files (unattend.xml and autounattend.xml) for unattended Windows installation..
         /// 
diff --git a/src/GenerateAnswerFile/Properties/Resources.resx b/src/GenerateAnswerFile/Properties/Resources.resx
index 7ff13d9..84c1a97 100644
--- a/src/GenerateAnswerFile/Properties/Resources.resx
+++ b/src/GenerateAnswerFile/Properties/Resources.resx
@@ -288,4 +288,7 @@ For more information, as well as usage examples, run '{0} -OnlineHelp', or see:
   
     Join the domain during the offlineServicing pass of Windows setup, rather than the specialize pass.
   
+  
+    The password to use for the built-in local Administrator account. If not specified, the Administrator account will be disabled by default.
+  
 
\ No newline at end of file
diff --git a/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationBios.json b/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationBios.json
index e0c5b5e..55f2dc7 100644
--- a/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationBios.json
+++ b/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationBios.json
@@ -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": [
diff --git a/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationEfi.json b/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationEfi.json
index 220948c..fa2959a 100644
--- a/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationEfi.json
+++ b/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationEfi.json
@@ -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": [
diff --git a/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationExisting.json b/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationExisting.json
index 83860e1..b93dc25 100644
--- a/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationExisting.json
+++ b/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationExisting.json
@@ -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,
diff --git a/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationManual.json b/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationManual.json
index a0b8800..4178fc8 100644
--- a/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationManual.json
+++ b/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationManual.json
@@ -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": {
diff --git a/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationPreInstalled.json b/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationPreInstalled.json
index b0f5447..a5674d0 100644
--- a/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationPreInstalled.json
+++ b/src/Ookii.AnswerFile.Tests/expected/TestJsonSerializationPreInstalled.json
@@ -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",
diff --git a/src/Ookii.AnswerFile/AnswerFileOptions.cs b/src/Ookii.AnswerFile/AnswerFileOptions.cs
index 5069b64..614667f 100644
--- a/src/Ookii.AnswerFile/AnswerFileOptions.cs
+++ b/src/Ookii.AnswerFile/AnswerFileOptions.cs
@@ -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";
 
     /// 
     /// Gets or sets the installation method to use, along with the options for that method.
@@ -167,17 +167,19 @@ public Collection LocalAccounts
         get => _localAccounts ??= new();
         set => _localAccounts = value;
     }
-    
+
     /// 
-    /// Gets or sets the administrator password for the system.
+    /// Gets or sets the password for the local Administrator account.
     /// 
     /// 
-    /// The password for the administrator account, or  if no password is to be set.
-    /// The default value is .
+    /// The password for the administrator account, or  to leave the account
+    /// disabled. The default value is .
     /// 
     /// 
     /// 
-    ///   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 , this account is disabled by default. If this property
+    ///   is set to an empty string, the account will be enabled with no password.
     /// 
     /// 
     ///   The password is stored using base64 encoding in the answer file; it is not encrypted.
@@ -192,6 +194,7 @@ public Collection LocalAccounts
     /// 
     /// 
     /// An instance of the  class, or  to not
+    /// An instance of the  class, or  to not
     /// use automatic log-on. The default value is .
     /// 
     /// 
diff --git a/src/Ookii.AnswerFile/Ookii.AnswerFile.csproj b/src/Ookii.AnswerFile/Ookii.AnswerFile.csproj
index 970e9e1..acfb32b 100644
--- a/src/Ookii.AnswerFile/Ookii.AnswerFile.csproj
+++ b/src/Ookii.AnswerFile/Ookii.AnswerFile.csproj
@@ -30,7 +30,7 @@
 
   
     
-    
+