So i'm pretty new to working with VMWare and PowerCLI but I'm trying to write an automation script to configure new ESX hosts. I'm getting stuck when it comes to adding our Domain Admins group as an admin on the ESXHost itself.
Was thinking something like:
$admin = "MyDomain\Domain Admins"
Get-VMHost | New-VIPermissions -Principal $admin -Propogate $True -Role Admin
Somehow I feel like I'm way off on this one though.
Essentially, I'm trying to perform the same function as if I added the Domain Admins throught the permissions tab on the host.
Any help would be appreciated.
To add to perms to individual ESX hosts, I believe you'll have to connect to each individual host first.
Connect-viserver ESXHost
$admin= "mydomain\domain admins"
New-VIPermissions -Principal $admin -role Admin -entity (get-datacenter) -propagate:$true
You could simply create an Active Directory group named: "ESX Admins" and make domain admins a member of that group.
ESX Admins gets added by default if detected by ESXi. At least I think this is still true. It was in 4.1
The only problem is that I don't have clearance to modify Active Directory in our environment. I'm creating the automation to step-by-step replace a SOP we have here, so despite there being easier or more efficient ways, this is the way I have to do it. :smileyplain:
Chris, it's still valid.
See Kyle's excellent Joining vSphere Hosts to Active Directory post.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi i think that in order to set it on the host itself you will need to connect to the host directly using powercli first. Otherwise you will be creating permissions via VC and not directly on the esx/i host.
IS this the problem you have, or do you have problem with running the command ?
Greg
To add to perms to individual ESX hosts, I believe you'll have to connect to each individual host first.
Connect-viserver ESXHost
$admin= "mydomain\domain admins"
New-VIPermissions -Principal $admin -role Admin -entity (get-datacenter) -propagate:$true
I have the script connecting to the host earlier on. It's sitting at ~400 lines at this point so I only pasted the snippet im working on right now.
Assuming this is the only host we are concerned about, and it does not speak with the other hosts: "get-datacenter" is what I should be using to define the entity value?
yeppers.
Thanks ^.^