Hi
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
Thanks LucD., As far I tested that is the only way to connect back the vmhost to vcenter. I didn't find any cmdlet.
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:
Connect-VIServer 10.50.56.151
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.
Shouldn't you be doing a Get-VMHostAuthentication before you do a Set-VMHostAuthentiation ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
not yet I will try now.
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,
10.50.56.151,10.50.56.65,10.50.56.107 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViServerCo
nnectionException
+ FullyQualifiedErrorId : ViCore_Login_CredentialNotFound,VMware.VimAutoma
tion.ViCore.Cmdlets.Commands.ConnectVIServer
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.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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.
Did you change the root password on the ESXi node while it was disconnected ?
Then you would have to do an Add-VMHost, where you supply the new root password.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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.
If this is the senerio how to I reconncet the host from Powercli. I can able to reconnect the host manually by supplying root credintials.
At that point I suspect you can only do a Remove-VMHost followed by an Add-VMHost.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD., As far I tested that is the only way to connect back the vmhost to vcenter. I didn't find any cmdlet.