The following function creates a user and role that allows the power up of VMs on a host. I use this account when vCenter is out of action and I need to run other functions to locate user VMs and power them up on particular hosts.

This function requires that you have the root password to the ESXi host.

	Function Write-LocalHostUser() {
	$creds=Get-Credential -Credential "root"
	$hostname=$hostname + "<FQDN>"
	Connect-VIServer -Server $hostname -Protocol https -Credential $creds
	New-VMHostAccount -Id "<username>" -Password "<password>" -Description "Account to be used to power up VMs in the event there is no vCenter."
	New-VIRole -Name "VM Power On Only" -Privilege “Power On”
	Set-VIRole -Role "VM Power On Only" -AddPrivilege "Assign network"
	New-VIPermission -Entity $hostname -Principal "powerup" -Role “VM Power On Only” -Propagate:$true