I need to supply User name and password while reconnecting Esxi host but with below lines I can't succeed. Please help.
Set-VMHost -State Connected -VMHost 10.50.56.151,10.50.56.65,10.50.56.107,10.50.56.168 |Set-VMHostAuthentication -Username root -Password 'trustno1' -JoinDomain $false
To use the Set-VMHostAuthentication cmdlet you have to make a connection with the host using the Connect-VIServer cmdlet. Did you do that? For example:
Set-VMHost -State Connected -VMHost 10.50.56.151 | Set-VMHostAuthentication -Username root -Password 'trustno1' -JoinDomain $false -Server 10.50.56.151
Disconnect-VIServer 10.50.56.151 -Confirm:$false
But these hosts are already connected in vcenter. I just changed root password and changed the host state into disconnected mode.Now I need to connect the host with in the Vcenter by supplying new password.
Tried like this but failed.
Is I am correct?
These servers are already disconnected in vcenter., I connected to Vcenter.
Set-VMHost -State Connected -VMHost 10.50.56.151,10.50.56.65,10.50.56.107,10.50.56.168 |Get-VMHostAuthentication |Set-VMHostAuthentication -Username root -Password 'trustno1' -JoinDomain $false
connect-viserver : 21-Dec-15 8:38:05 PM Connect-VIServer Could not
determine user name and/or password for server 10.50.56.168
At line:1 char:1
+ connect-viserver 10.50.56.151,10.50.56.65,
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViServerCo
+ FullyQualifiedErrorId : ViCore_Login_CredentialNotFound,VMware.VimAutoma
You are mixing two things here.
The host connection state with the Set-VMHost and the host authentication mechanism with the Set-VMHostAuthentication.
The Set-VMHost cmdlet will output a VMhost object, the Set-VMHostAuthentication cmdlet expects a VMHostAuthentication object in the pipeline.
OK., So How to connect the disconnected VMhost which is already in vcenter and root password is changed. Now I need to supply new password for root to connect back the vmhost in vcenter.
LucD., My senerio is like this..
1.For some Esxi hosts root passwd expired.
2.I Ssh to that host and changed root password &
3.I Disconnected the Esxi from vcenter which I changed root passwd
4.Now if I try to reconnect the esxi host from vcenter by right click connect then it will ask for credentials right... so is there any way to reconnect the esxi host which is already in vcenter through Powercli by passing new password.
Could Add-VMHost works if I try to add the host which is already in vcenter or should I remove the host and re add the host with Add-VMHost cmdlet.
Afaik, the vCenter uses the vpxuser account to connect to an ESXi host, not the root account.
It's only when you add a new ESXi host to a vCenter, that you need to give a root account.
When the vpxuser password expires (30 days by default) at the same moment, then you will have to an Add-VMHost afaik
I totally agree with you. The thing you said work upuntil the host is in connected state.,But it will ask for credentials when ever you try to disconnect/reconnect the host or reboot the host by keeping in maintenance mode.
I Tested manually like changing the root password of host which is in vcenter and disconnected the host from vcenter and if I try to reconnect it throughs error as authentication failed.