Unattended Setup Generic Command For Domain Join
djoin
- C:\Windows\system32\djoin.exe /?
Output:
Usage: djoin.exe [/OPTIONS]
/PROVISION - Provision a computer account in the domain
/DOMAIN <Name> - <Name> of the domain to join
/MACHINE <Name> - Host <Name> of the computer joining the domain
/MACHINEOU <OU> - Optional <OU> where the account is created
/DCNAME <DC> - Optional <DC> to target for account creation
/REUSE - Reuse any existing account (password will be reset)
/SAVEFILE <FilePath> - Save provisioning data to a file at <FilePath>
/NOSEARCH - Skip account conflict detection, requires DCNAME (faster)
/DOWNLEVEL - Support using a Windows Server 2008 DC or earlier
/PRINTBLOB - Return base64 encoded metadata blob for an answer file
/DEFPWD - Use default machine account password (not recommended)
/ROOTCACERTS - Opt. include root Certificate Authority certificates.
/CERTTEMPLATE <Name> - Optional <Name> of machine certificate template.
Includes root Certificate Authority certificates.
/POLICYNAMES <Name(s)> - Opt. semicolon-separated list of policy names.
Each name is the displayName of the GPO in AD.
/POLICYPATHS <Path(s)> - Opt. semicolon-separated list of policy paths.
Each path is a path to a registry policy file.
/NETBIOS <Name> - Opt. Netbios <Name> of the computer joining the domain.
/PSITE <Name> - Opt. <Name> of persistent site to put the computer joining
the domain in.
/DSITE <Name> - Opt. <Name> of dynamic site to initially put the computer
joining the domain in.
/PRIMARYDNS <Name> - Opt. <Name> of primary DNS domain of the computer
joining the domain.
/REQUESTODJ - Request offline domain join at next boot
/LOADFILE <FilePath> - <FilePath> specified previously via /SAVEFILE
/WINDOWSPATH <Path> - <Path> to the Windows directory in an offline image
/LOCALOS - Allows /WINDOWSPATH to specify the locally running OS.
This command must be run as a local Administrator.
This option requires a reboot for changes to be applied.
Examples:
To provision a computer account in the domain:
djoin.exe /PROVISION /DOMAIN <DomainName> /MACHINE <MachineName>
/SAVEFILE <FilePath>
Note: Other parameters are optional
To request the local machine to perform an offline domain join:
djoin.exe /REQUESTODJ /LOADFILE <FilePath> /WINDOWSPATH <Path>
Note: Other parameters are optional
Return Code: 0
C:\Windows\system32\djoin.exe
c:\>ver
Microsoft Windows [Version 10.0.19045.2075]
| File | Info |
|---|---|
| File Size | 75776bytes |
| Creation Time | 2022/07/08 08:48:13 |
| LastWrite Time | 2022/07/08 08:48:13 |
| ProductVersion | 10.0.19041.1 |
| FileVersion | 10.0.19041.1 (WinBuild.160101.0800) |
| Hash | Value |
|---|---|
| MD5 | ff5c38dd0921a67df289f72f8f761e51 |
| SHA1 | 79d617858b62db80f0694dadcff037cd82e20b68 |
| SHA224 | d8f8d0d9eaa22d612f5d8960af3be619e3cdc5f9b8a0853276c5183f |
| SHA256 | ca5d6bf4976215adefbe7c94132eeb123fd5724a508896f1f9a557eecdefe505 |
| SHA384 | 9cbda9f1c6d2c11560140721f2ac382a51e6c26fa3cd2f09a9a6a15d9fe858d5839caf4d245a71f05dc70b61fcaf0ad6 |
| SHA512 | 55bd548b29fd1513523bdb1922cd222e6c58621935bcb26e7bc286ecffc504cba0e9f2def96013c4e29e0da569c072375c12700faa44c4f795054bc8bb93d5b9 |