Hey all,
Am just updating my automated shutdown script which my UPS runs if there is a power failure. Have used it fine in the past but realized it hangs up when trying to shutdown my vCenter VM as off course, the script it logging on to vCenter so can't shut itself down. So what I want to do is after its connected to vCenter and shutdown all the VMs, is disconnect from vCenter, logon directly to the host which has vCenter VM running (always host 1) and then shut the VM down followed by each of the hosts.
So far though I have the problem that I can't logon directly to the ESXi hosts with my UPS account and I can't find the privlige to let me do it. I have given it Host/Configuration/Maintenance and Host/Configuration/Power but I still get a permission denied when trying to logon directly to the host with Powershell. I guess its because my hosts are all managed by vCenter & Active Directory or I'm missing the right privilege.
Here is the error I get:-
PowerCLI D:\Scripts> Connect-VIServer 172.25.8.22 -user mydomain\esxups -password thisismypassword Connect-VIServer : 22/05/2013 11:37:12 a.m. Connect-VIServer Permission to perform this operation was denied. At line:1 char:17 + Connect-VIServer <<<< 172.25.8.22 -user fal\esxups -password ups!control + CategoryInfo : NotSpecified: (:) [Connect-VIServer], NoPermission + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Exception,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer PowerCLI D:\Scripts>
Also, if anyone knows how I can set a variable of what host the vCenter VM is running and then have the script connect to that host instead of the IP above, just in case it ever changes, that'll be awesome as I'm new to powershell and can't figure it out.
Thanks,
Andy