You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Details of the scenario you tried and the problem that is occurring
When using Offline Domain Join (RequestFile parameter) with the ADComputer resource, the process fails if the OU (Path parameter) contains spaces.
Running djoin.exe myself from the command line worked.
Verbose logs showing the problem
The error is very confusing:
PowerShell DSC resource MSFT_ADComputer failed to execute Set-TargetResource functionality with error message:
System.InvalidOperationException: Failed to create the Offline Domain Join (ODJ) request file for the computer account 'computer02' with
the error code '87'. (ADC0014)
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : localhost
I was finally able to track down a log I never knew existed (C:\Windows\Panther\UnattendGC\setupact.log), where I could that a successful run (via command line) looked like this:
2020-05-28 19:45:35, Info [djoin.exe] Unattended Join: Begin
2020-05-28 19:45:35, Info [djoin.exe] Unattended Join: Provision computer account
2020-05-28 19:45:35, Info [djoin.exe] Unattended Join: Domain: ab.contoso.com
2020-05-28 19:45:35, Info [djoin.exe] Unattended Join: Machine:computer02
2020-05-28 19:45:35, Info [djoin.exe] Unattended Join: MachineOU:OU=Some Servers,OU=Operations,OU=Hosts,DC=ab,DC=contoso,DC=com
2020-05-28 19:45:35, Info [djoin.exe] Unattended Join: The operation will target the DC: dc102.ab.contoso.com
2020-05-28 19:45:35, Info [djoin.exe] Unattended Join: Provisioning blob will be saved to a file C:/ODJ/computer02.txt
An unsuccessful run (via DSC):
2020-05-28 19:46:55, Info [djoin.exe] Unattended Join: Begin
2020-05-28 19:46:55, Info [djoin.exe] Unattended Join: Provision computer account
2020-05-28 19:46:55, Info [djoin.exe] Unattended Join: Domain: ab.contoso.com
2020-05-28 19:46:55, Info [djoin.exe] Unattended Join: Machine:computer02
2020-05-28 19:46:55, Info [djoin.exe] Unattended Join: MachineOU:OU=Some
Suggested solution to the issue
The error occurs because when the ADComputer resource needs to run djoin.exe, it uses the common utility function Start-ProcessWithTimeout, which uses Start-Process. It creates an array of arguments for the -ArgumentList parameter, but Start-Process does not do quoting for you, so you must quote individual arguments yourself if they contain spaces.
Suggested solution is to apply proper quoting to the arguments passed, keeping in mind that however arcane, OU names could themselves contain quotes and backslashes and caret and all kinds of other characters that could mess up simple quoting.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
This does successfully create the computer account in the correct OU, and it creates the ODJ file, but the rest of the commands in the DSC resource fail as it tries to move the computer to the "correct" OU and update its hostname for some reason, so the overall DSC run will fail.
Details of the scenario you tried and the problem that is occurring
When using Offline Domain Join (
RequestFile
parameter) with theADComputer
resource, the process fails if the OU (Path
parameter) contains spaces.Running
djoin.exe
myself from the command line worked.Verbose logs showing the problem
The error is very confusing:
I was finally able to track down a log I never knew existed (
C:\Windows\Panther\UnattendGC\setupact.log
), where I could that a successful run (via command line) looked like this:An unsuccessful run (via DSC):
Suggested solution to the issue
The error occurs because when the
ADComputer
resource needs to rundjoin.exe
, it uses the common utility functionStart-ProcessWithTimeout
, which usesStart-Process
. It creates an array of arguments for the-ArgumentList
parameter, butStart-Process
does not do quoting for you, so you must quote individual arguments yourself if they contain spaces.This is covered in the documentation for
Start-Process
in the-ArgumentList
parameter and in example 7.Suggested solution is to apply proper quoting to the arguments passed, keeping in mind that however arcane, OU names could themselves contain quotes and backslashes and caret and all kinds of other characters that could mess up simple quoting.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used
The text was updated successfully, but these errors were encountered: