This page describes the command line arguments supported by the Answer File Generator, which are used to customize the generated answer file. All argument names are case insensitive.
Argument values can be specified as either e.g. -JoinDomain mydomain, -JoinDomain:mydomain or
-JoinDomain=mydomain.
Some arguments can be specified multiple times. This can be done by listing several values after the argument:
-LocalAccount "John,Password" "Dave,OtherPassword" -EnableRemoteDesktop
Or, by repeating the argument multiple times, potentially interleaving other arguments:
-LocalAccount "John,Password" -EnableRemoteDesktop -LocalAccount "Dave,OtherPassword"
This syntax makes Answer File Generator compatible with PowerShell hash table splatting, which can be a convenient way to handle invocations with many arguments.
$arguments = @{
"OutputPath" = "unattend.xml"
"InstallMethod" = "CleanEfi"
"Feature" = "Microsoft-Windows-Subsystem-Linux","VirtualMachinePlatform"
"WindowsVersion" = "10.0.22621.1"
"EnableRemoteDesktop" = $true
}
./GenerateAnswerFile @argumentsThe arguments are split into several categories:
GenerateAnswerFile
[-OutputFile] <Path>
[-AutoLogonCount <Number>]
[-AutoLogonPassword <String>]
[-AutoLogonUser <[Domain\]User>]
[-CmdKeyPassword <String>]
[-CmdKeyUser <Domain\User>]
[-ComputerName <String>]
[-DisableCloud]
[-DisableDefender]
[-DisableServerManager]
[-DisplayResolution <Size>]
[-DomainAccount <String>...]
[-EnableRemoteDesktop]
[-Feature <String>...]
[-FirstLogonCommand <String>...]
[-Help]
[-ImageIndex <Number>]
[-Install <InstallMethod>]
[-InstallToDisk <Number>]
[-InstallToPartition <Number>]
[-JoinDomain <String>]
[-JoinDomainPassword <String>]
[-JoinDomainUser <[Domain\]User>]
[-Language <String>]
[-LocalAccount <Name,Password>...]
[-OnlineHelp]
[-OUPath <String>]
[-Partition <Label:Size>...]
[-ProcessorArchitecture <String>]
[-ProductKey <String>]
[-SetupScript <String>...]
[-TimeZone <String>]
[-Version]
[-WindowsVersion <Version>]
The path and file name to write the answer file to.
Value: <Path>
Aliases: -o
Required: True
Positional: TrueDisplays a help message.
Value: [<Boolean>]
Aliases: -?, -hShows additional help in your web browser, including example usage.
Value: [<Boolean>]
Aliases: -oh, -??Displays version information.
Value: [<Boolean>]The name of an optional feature to install. Use the PowerShell Get-WindowsOptionalFeature command
to get a list of valid feature names. Can have multiple values.
Must not be blank.
See optional features.
Value: <String> (multiple allowed)
Aliases: -c
Required arguments: -WindowsVersion
Allowed -Install values: ExistingPartition, CleanBios, CleanEfi, ManualThe index of the image in the WIM file to install. Use this for Windows editions not installed using
a product key, such as those that use volume licensing. Use the PowerShell Get-WindowsImage
command to list all images in a .wim or .esd file.
See selecting the edition to install.
Value: <Number>
Aliases: -wim
Allowed -Install values: ExistingPartition, CleanEfi, CleanBiosThe installation method to use.
See installation method.
Value: PreInstalled, ExistingPartition, CleanEfi, CleanBios, Manual
Aliases: -i
Default value: PreInstalledThe zero-based ID of the disk to install to. This disk will be wiped and repartitioned according to
-Partition, or using the default layout if -Partition is not
specified.
Must be at least 0.
Value: <Number>
Aliases: -disk
Default value: 0
Allowed -Install values: ExistingPartition, CleanEfi, CleanBiosThe one-based ID of the partition to install to, on the disk specified by
-InstallToDisk. If not specified and -Install is CleanEfi or
CleanBios, Windows will be installed on the first regular data partition. If
-Install is ExistingPartition, the default value is 3, which is appropriate for
UEFI systems with the default partition layout.
Must be at least 1.
Value: <Number>
Aliases: -part
Allowed -Install values: CleanEfi, CleanBios, ExistingPartitionA partition to create on the disk specified by -InstallToDisk. Can have
multiple values.
Use the format label:size or label:size[fs], where label is the volume label, size is the size
of the partition, and fs is an optional file system like FAT32 or NTFS. Sizes can use multiple-byte
units such as GB, and will be truncated to whole megabytes. For example System:100MB,
Windows:128GB, or Data:16GB[FAT32].
Use * as the size to extend the partition to fill the remainder of the disk (e.g. Windows:*).
Use the following labels to create special partitions: System, MSR, WinRE, and Recovery.
If not specified, the default partition layout for the method specified by -Install
is used.
Value: <Label:Size> (multiple allowed)
Aliases: -p
Allowed -Install values: CleanEfi, CleanBiosThe product key used to select what edition to install, and to activate Windows.
Must not be blank.
See selecting the edition to install.
Value: <String>
Aliases: -keyThe exact version and build number (e.g. 10.0.22621.1) of the OS being installed. This argument is
only used when -Feature is specified.
Value: <Version>
Aliases: -vThe password of the user specified by -CmdKeyUser.
Must not be blank.
Value: <String>
Aliases: -ckp
Required arguments: -CmdKeyUserThe name of a user used to access all network resources, in domain\user format. If present, the
cmdkey.exe application will be used at first logon to save this user's credentials for all network
paths
Must not be blank.
Value: <Domain\User>
Aliases: -cku
Required arguments: -CmdKeyPasswordA local account to create, using the format name,password. Can have multiple values. If no local
accounts are created, the user will be asked to create one during OOBE, making setup not fully
unattended.
See creating a user during installation.
Value: <Name,Password> (multiple allowed)
Aliases: -aThe number of times the user specified by -AutoLogonCount will be
automatically logged on.
Must be at least 1.
Value: <Number>
Aliases: -alc
Default value: 1
Required arguments: -AutoLogonUserThe password of the user specified by -AutoLogonCount.
Must not be blank.
Value: <String>
Aliases: -alp
Required arguments: -AutoLogonUserThe name of a user to automatically log on, in the format domain\user, or just user for local
users. If not specified, automatic logon will not be used.
Must not be blank.
See joining a domain and automatic logon.
Value: <[Domain\]User>
Aliases: -alu
Required arguments: -AutoLogonPasswordThe name of a domain account to add to the local administrators group. Must be in the domain you're joining. Can have multiple values.
Must not be blank.
Value: <String> (multiple allowed)
Aliases: -da
Required arguments: -JoinDomainThe name of a domain to join. If not specified, the system will not be joined to a domain.
Must not be blank.
See joining a domain and automatic logon.
Value: <String>
Aliases: -jd
Required arguments: -JoinDomainUser, -JoinDomainPasswordThe password of the user specified by -JoinDomainUser. Will be stored in plain
text.
Must not be blank.
Value: <String>
Aliases: -jdp
Required arguments: -JoinDomainThe name of a user with permission to join the domain specified by -JoinDomain.
Use the format domain\user, or just user if the user is a member of the domain you are joining.
Must not be blank.
Value: <[Domain\]User>
Aliases: -jdu
Required arguments: -JoinDomainThe organizational unit to use when joining the domain specified by -JoinDomain.
Must not be blank.
Value: <String>
Aliases: -ou
Required arguments: -JoinDomainThe network name for the computer.
Must not be blank.
Value: <String>
Aliases: -nDisable Windows cloud consumer features. This prevents auto-installation of recommended store apps.
Value: [<Boolean>]
Aliases: -dcDisable Windows Defender virus and threat protection.
Value: [<Boolean>]
Aliases: -dDo not automatically start Server Manager when logging on (Windows Server only).
Value: [<Boolean>]
Aliases: -dsmThe display resolution, in the format width,height. For example, 1920,1080. If not specified,
the default resolution is determined by Windows.
Value: <Size>
Aliases: -resTurn on remote desktop, and create a Windows Defender Firewall rule to allow incoming connections.
Value: [<Boolean>]
Aliases: -rdpA command to run during first logon. Can have multiple values. Commands are executed before the
scripts specified by -SetupScript.
Must not be blank.
See first log-on commands and scripts.
Value: <String> (multiple allowed)
Aliases: -cmdThe language used for the UI language, and the input, system and user locales.
Must not be blank.
Value: <String>
Aliases: -lang
Default value: en-USThe processor architecture of the Windows edition you're installing. Use amd64 for 64 bit Intel
and AMD processors, x86 for 32 bit, and arm64 for ARM-based devices.
Must not be blank.
Value: <String>
Aliases: -arch
Default value: amd64The full path of a Windows PowerShell script to run during first logon. Can have multiple values.
Scripts are executed after the commands specified by -FirstLogonCommand.
Must not be blank.
See first log-on commands and scripts.
Value: <String> (multiple allowed)
Aliases: -sThe time zone that Windows will use. Run tzutil /l for a list of valid values.
Must not be blank.
Value: <String>
Default value: Pacific Standard Time