Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The system cannot find the file specified. #88

Closed
marksie1988 opened this issue Jan 12, 2024 · 4 comments · Fixed by #92
Closed

The system cannot find the file specified. #88

marksie1988 opened this issue Jan 12, 2024 · 4 comments · Fixed by #92

Comments

@marksie1988
Copy link

SUMMARY

Trying to join a number of Windows server 2022 to a test domain and they all keep failing saying "the system cannot find the file specified.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

microsoft.ad.membership

ANSIBLE VERSION
ansible 2.10.8
COLLECTION VERSION
Collection   Version
------------ -------
microsoft.ad 1.4.1
CONFIGURATION
DEFAULT_ROLES_PATH(env: ANSIBLE_ROLES_PATH) = ['/home/user/repos/lab/ansible/roles~']
HOST_KEY_CHECKING(/home/user/repos/lab/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Server 2022

STEPS TO REPRODUCE

I am using the following play:

    - name: Join members to domain
      microsoft.ad.membership:
        dns_domain_name: "{{ dns_domain_name }}"
        domain_admin_user: "{{ domain_admin_user }}"
        domain_admin_password: "{{ domain_admin_password }}"
        domain_ou_path: "{{ domain_join_ou_path }}"
        state: domain
        reboot: true

with these groupvars:

dns_domain_name: "lab.com"
domain_netbios_name: "LAB"
domain_admin_user: "[email protected]"
domain_admin_password: "mypassword"
domain_join_ou_path: "OU=Windows,OU=Servers,DC=lab,DC=com"
EXPECTED RESULTS

Servers should be joined to the domain

ACTUAL RESULTS
The full traceback is:
Computer 'sql-1' failed to join domain 'lab.com' from its current workgroup 'WORKGROUP' with following error message: The system cannot find the file specified.
At line:210 char:13
+             Add-Computer @joinParams
+             ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (sql-1:String) [Add-Computer], InvalidOperationException
    + FullyQualifiedErrorId : FailToJoinDomainFromWorkgroup,Microsoft.PowerShell.Commands.AddComputerCommand

ScriptStackTrace:
at <ScriptBlock>, <No file>: line 210
fatal: [sql-1]: FAILED! => {
    "changed": false,
    "msg": "Unhandled exception while executing module: Computer 'sql-1' failed to join domain 'raxlab.com' from its current workgroup 'WORKGROUP' with following error message: The system cannot find the file specified."
}
@jborean93
Copy link
Collaborator

Unfortunately as the error is happening inside Add-Computer we don't have much control over how/why it is failing. An older issue ansible/ansible#57313 seemed to indicate the domain_ou_path may have been invalid in that scenario so this would be a good place to start investigation. Running the same command locally outside of Ansible might also help narrow down if it's a network logon problem or something else.

@marksie1988
Copy link
Author

I ran the command outside of ansible and In this instance it also seems that this was caused by the OU not existing as its a test lab, I have removed that and it works now.

Not sure if it would be a good idea to add a message if this error happens to warn users it could be an incorrect OU path?

@jborean93
Copy link
Collaborator

It would be a nice idea except that it would require a fair bit of code to resolve the domain controller hostname to actually do the ldap queries. I’m not sure if there is a builtin Windows mechanism to do so outside of what Add-Computer does internally.

@jborean93
Copy link
Collaborator

I've just merged #92 which tries to catch this particular error and add on a note saying to check the domain_ou_path on a failure. Hopefully that should help others who come across this problem in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants