We are facing an issue for a particular customer where programmatically joining a machine to a domain is failing. The machine is cloned from a parent VM and attempted to be joined to the domain using Windows NetJoinDomain API.


We are doing an unsecure join using machine password. Connectivity to the Domain controller is fine and it works if we try to join to the domain manually. Also, programmatically joining domain is working for other customers. I suspect there is some setting in their DC which is rejecting unsecure joins using machine password.

How to confirm this and/or debug further. Any pointers on this would be highly appreciated.

The error message is I am getting is -- (0x5): Access is denied.

PS: Also a strange this is that this does-not happen if parent VM is NOT joined to the domain

  • Tough to say - you should look at the logs on the client machine. Probably c:\Windows\debug\netsetup.log, maybe some other logs. Event Viewer might help. Looking at Event Viewer on the DC it's connecting to might shed some light on this as well.
    – mfinni
    Apr 6, 2021 at 15:48
  • 4
    If the parent VM was joined to the domain, maybe your cloned VMs suffer from duplicate machine SID ?
    – shodanshok
    Apr 6, 2021 at 16:54


You must log in to answer this question.

Browse other questions tagged .