Hi guys,
Found this great script online that joins all ESX to domain. I am trying to modify it and also set permissions on each ESX server to a security group or a username. I can't really get it to work as it does set the permission but it set it within vcenter itself for that host and I want the permission to be set within ESX. I am using the option with vcenter so I am guessing once PS connect to Vcenter it needs to reconnect to ESX to do that.
These are the lines I added to the script but it still doesnt work. I would request anyone with more experience on powercli to help me fix this.
Appreciate it. BTW I want to give credit to whoever created this script initially.
#Set Active Directory Permissions within each ESX host
connect-viserver $VMHost -credential $VMHosts_creds > $NULL 2>&1
New-VIPermission -Principal "domain\username" -role admin -entity $getvmhost
disconnect-viserver $VMHost -confirm:$false