VMware Cloud Community
M_Sandoval
Contributor
Contributor

Using a hashtable to update host customizations

Greetings All,

I'm trying to use powercli to update our AD authentication credentials in the host customizations. I found the relevant key names by resetting a hosts' customizations and then running the command...

Get-VMHost esxi1.contoso.com | Get-VMHostProfileRequiredInput | ft -autosize

 

I then created a hash table per Microsoft's help pages...

$requireInput = @{}
$requireInput.add('authentication.activeDirectory.JoinDomainMethodPolicy.userName','Idiot')
$requireInput.add('authentication.activeDirectory.JoinDomainMethodPolicy.password','12345')

 

I then ran the following command to try to apply the customizations...
Invoke-VMHostProfile esx1.contoso.com -Variable $requireInput -Profile esxprofile

 

However, the output always complains about the password being blank or the password type being incorrect (as follows)...

Invoke-VMHostProfile : 9/21/2022 10:19:04 PM Invoke-VMHostProfile The profile 'esxprofile' can not be applied
on host 'esx1.contoso.com': 'Invalid parameter type for parameter password'

 

Anyone have any idea how to fix this?

Can AD authentication passwords even be set this way?

 

Any help would be appreciated.

Thanks in advance!

Labels (3)
0 Kudos
1 Reply
LucD
Leadership
Leadership

Afaik, the password value should be of type System.Security.SecureString.
But there is no documentation whatsoever that I know that explains how to provide such a type, nor if there should be any encoding done.

Btw, that is a general problem with HostProfiles, the documentation is abissimal.
No wonder HostProfiles are on the way out.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos