Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Join domain ESXi to an Active Directory OU : Powercli

November 27, 2017 02:44PM

I received request from my internal team to provide a small solution on Esxi Domain join and created when pulled it in domain computer account should be created in specific OU (Organization Unit). To perform this task first, we need complete OU path, to find it open Active Directory Users and Computers, on the View menu click Advanced Features. For more on be

POWERCLI AND VSPHERE WEB CLIENT: JOIN ESXI INTO ACTIVE DIRECTORY DOMAIN CONTROLLER
Resolved: Esxi Join domain failed-Error in Active Directory Operations

active directory domain controller, menu view, Advanced Features, esxi computers joing domain

Next click on the OU where you want to create Esxi Computer Account. Right click on OU and go to properties, You will see an Object tab, (This Object tab is only visible when Advanced features is enabled), Under it find Canonical name of object and copy paste OU path.

vmware vsphere esxi active directory domain controller, usn esxi computer account organazation unit, ou properties canonica name of object, object class tab.png

On the ESXi server when you try ESXi Join Domain under Authentication services. Use the path in Domain. Once esxi is joined to domain successfully, you will see new Esxi host computer account is created in active directory dsa.msc. If you are seeing an issue check my below article.

Resolved: Esxi Join domain failed-Error in Active Directory Operations

esxi join domain, domain settings, organization unit, ou using credentials.vmware vsphere, vcenter, proxy server, active directory users and computers, esxi computer account type


Next Same task I will perform using Active directory Powershell plug in and VMware vSphere Powercli. First to get OU canonical name running below command. Installing, importing and using any module in powershell
Get-ADOrganizationalUnit -Filter {Name -eq 'ESXi'} -Properties Canonicalname | Select CanonicalName

On the vSphere Powercli execute below command, This joins multiple Esxi server to AD domain at once to selected OU.
Get-VMHostAuthentication | Set-VMHostAuthentication -Domain 'vcloud-lab.com/Demo/ESXi' -JoinDomain -Username 'vkunal@vcloud-lab.com' -Password 'Computer@1' -Confirm:$false

POWERCLI INITIALIZE-POWERCLI ENVIRONMENT.PS1 CANNOT BE LOADED BECAUSE RUNNING SCRIPTS IS DISABLED
VMWARE VSPHERE POWERCLI INSTALLATION AND CONFIGURATION STEP BY STEP

Microsoft active directory module, get-AdorgnizationalUnit, ou, canonicalname, Get-vmhostauthentication, set-vmhostauthentication, join domain,domain membership, vmware vsphere, powercli,powershell,domain controller.png

If there are no errors on PowerCLI while executing commands, Computer Accounts are created successfully and same can be verified using below one liner cmdlet.
Get-ADComputer -SearchBase 'OU=ESXi,OU=Demo,DC=vcloud-lab,DC=com' -Filter *

Microsoft active directory module, get-AdorgnizationalUnit, ou, canonicalname, Get-ADComputer, searchbase ou, computer account, join domain,domain membership, vmware vsphere, powercli,powershell,domain controller.png

Useful Blogs
VMWare Powercli: Time Configuration (NTP - Network Time Protocol) on multiple Esxi server
vSphere PowerCLI - Configure syslog on VMware ESXi hosts and Enable security profile firewall

Go Back

Comment