Create Domain Admins group on ESXI5.1 Host


For all those wanting to access the local host of ESXI with Domain credentials rather than root account, have a look at this script.

I have written a script that creates a domain group on the root of ESXI 5.1 so that admins can access ESXI hosts locally with domain credentials. For this to work, the ESXI host will need to be domain joined before running the script.

Powershell_ESXIHOST

Script:

# VMware ESXI Script to create Domain group on Root of ESXI Host
# Created by Ryan Mangan on the 16/04/2014

param (
[Parameter(Mandatory=$TRUE, HelpMessage=”Enter the name of the ESXI Host FQDN”)]
[String]
$VMHost,

[Parameter(Mandatory=$TRUE, HelpMessage=”Host Root Password Dual control”)]
[String]
$HostPW
)

$DomainAdmin   = “Domain Account”
$DomainPW      = “Password”
$ADGroup       = “Domain\group”
$Domain        = “Domain FQDN”

Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer SVMHost -User root -Password $HostPW
Get-VMHostAuthentication -VMHost $VMHost | Set-VMHostAuthentication -Domain $Domain -Username $DomainAdmin -Password $DomainPW -JoinDomain -Confirm:$false
Get-VMHost $VMHost | New-VIPermission -Principal $ADGroup -Role “Admin”
Disconnect-VIServer $VMHost -Confirm:$false

(Download here)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s