There are many possibilities for using PowerShell on non-Windows platforms now and today my mind was pondering how to use it to join Linux servers to Active Directory. So, I created a small little function that automates some of this called Join-LinuxToAD. Keep in mind I tested this only on CentOS 7.
The script does the following:
- Ensures you can lookup the domain with nslookup
- Ensures Samba and other dependencies are installed via yum
- Uses the realm command to join the local server to an Active Directory domain
While this is not totally automated, it does at least some of the work for you. I use $LASTEXITCODE has a way to do some error checking in the script.
Now lets run it:
Got a project that needs expert IT support?
From Linux and Microsoft Server to VMware, networking, and more, our team at CR Tech is here to help.
Get personalized support today and ensure your systems are running at peak performance or make sure that your project turns out to be a successful one!
CONTACT US NOW