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