When I run the script: $ESXHOST = Read-Host "Enter ESX Host Name or IP" Connect-VIServer $ESXHOST $domain = "MyDomain" Write-Host "Join to domain $domain" $cred = Get-Credential # Prompt for the user and password #Write-Host "Credentials: $cred" $host | Get-VMHostAuthentication | Set-VMHostAuthentication -Domain $domain -Credential $cred exit I get this error: PowerCLI E:\PowerCLI 5.0\Scripts> .\Join.ps1 Enter ESX Host Name or IP: esx22 Name Port User ---- ---- ---- esx122 443 root Join to domain SCS.local cmdlet Get-Credential at command pipeline position 1 Supply values for the following parameters: Credential cmdlet Set-VMHostAuthentication at command pipeline position 2 Supply values for the following parameters: JoinDomain: scs.local Set-VMHostAuthentication : Cannot convert 'System.String' to the type 'System.Management.Automation.SwitchParameter' required by parameter 'JoinDomain'. At E:\PowerCLI 5.0\Scripts\RSA\RSA_Join.ps1:10 char:60 + $host | Get-VMHostAuthentication | Set-VMHostAuthentication <<<< -Domain scs.local -Credential $cred + CategoryInfo : InvalidArgument: (:) [Set-VMHostAuthentication], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgument,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.SetVMHostAuthentication Even though I have specified the domain "MyDomain" I get prompted "Join to domain:", and even though I get the error which probably is about the Set-VMHostAuthentication. Shouldn't it be straight forward ?
↧
Set-VMHostAuthentication error
↧