11

Join Linux to Active Directory with PowerShell Core

 3 years ago
source link: https://microsoftgeek.com/?p=3007
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Join Linux to Active Directory with PowerShell Core

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.

linux1-1-1024x604.png

Now lets run it:

linux2.png


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK