Join Windows AD without restarting Services


shwa87

Recommended Posts

As the title says, make it easy in the GUI to join an AD domain w/o having to restart services.  This is particularly useful if the domain controller is running within a VM on the unRAID host.  Easy CLI method uses net join -U Administrator, where Administrator is the admin user, but having to launch into a terminal session every time gets to be a bit of a drag.

 

As an extension to this, it would be great if unRAID automatically "rejoined" the domain after a restart after detection that the domain controller VM was up and ready.

 

Alternatively if none of this is easily possible, add an option to "refresh" the join status in the GUI after manually joining via CLI.

Link to comment

Not downplaying the value of the request, but you should be able to script a work around fairly easily.

User scripts, something like this, scheduled to run at array start.

#!/bin/bash
printf "%s" "waiting for domain controller ..."
# Change IP to the DC
while ! ping -c 1 -n -w 1 192.168.10.10 &> /dev/null
do
    printf "%c" "."
done
printf "\n%s\n"  "domain controller is back online"
# Change number of seconds to a sane number that will ensure the target service is ready
sleep 30
net join -U Administrator

 

Link to comment
25 minutes ago, JonathanM said:

Not downplaying the value of the request, but you should be able to script a work around fairly easily.

User scripts, something like this, scheduled to run at array start.

#!/bin/bash
printf "%s" "waiting for domain controller ..."
# Change IP to the DC
while ! ping -c 1 -n -w 1 192.168.10.10 &> /dev/null
do
    printf "%c" "."
done
printf "\n%s\n"  "domain controller is back online"
# Change number of seconds to a sane number that will ensure the target service is ready
sleep 30
net join -U Administrator

 

I thought the same and did try this -- but a password is required after entering the net join... command and I haven't been able to script a way to pass that securely.

Link to comment
12 minutes ago, shwa87 said:

I haven't been able to script a way to pass that securely.

https://www.howtogeek.com/734838/how-to-use-encrypted-passwords-in-bash-scripts/

openssl is in Unraid stock, sshpass needs to be added, I didn't do the legwork to find a package that I know will work in Unraid, but this might get you started.

https://slackware.pkgs.org/current/slackers/sshpass-1.09-x86_64-1cf.txz.html

Link to comment
On 9/5/2022 at 5:11 AM, shwa87 said:

I thought the same and did try this -- but a password is required after entering the net join... command and I haven't been able to script a way to pass that securely.

HI,

i think, you should not use "Domain Admin" to join to domain. Maybe you should have a look to delegate this task to a user. Does not solve the issue, to pass it securely :-(.
Did you find a working solution, running into the same issue.

br

Chris

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.