Script for ESXi Host AD Join

This post was originally published on this site

Hi All,

I have frequently few esxi hosts goes out of domain or my AD group permissions will go away in my infrastructure..sometime its count will be more around 50+.


To login each host add them in domain and add my AD group is lengthy process.


Is there a script which can do it in single shot, for below requirement.


Script should


1. Connect all my vCenters

2. Pick the host from Get-Content ( which will have my hosts which are out of domain)

3. Should ask the default ESXi root password

4. Should take host in Maintenance Mode

5. Then it should join the esxi host in domain

6. Then it should add my AD group

7. Finally Exit from maintenance mode

8. Export the output report in CSV which all host it could able to join domain and add AD group and exited it from Maintenance Mode.




Thanks a Ton in Advance.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.