VMware {code} Community
Silvio_Knizek
Contributor
Contributor

Setting Security.PasswordQualityControl with esxcli

Hi,

so, I'm tasked to change the Security.PasswordQualityControl setting on my machines. As this has to be done during the installation, I need to use localcli, esxcli, or vim-cmd.

I know how it works with vim-cmd, but AFAIK this tool is deprecated. Is there a way to set this advanced option with esxcli/localcli?

BR
Silvio

Reply
0 Kudos
1 Reply
doskiran
Enthusiast
Enthusiast

I could see the option "/Security/PasswordQualityControl" is not available in esxcli/esxcfg-advcfg advanced settings list.
Eg:
> esxcli system settings advanced list | grep Path:
> esxcfg-advcfg -l
 
But we can update the advanced setting for "/Security/PasswordQualityControl" using vSphere PowerCLI or SOAP-based APIs or MOB..

PowerCLI:

 

$PasswordPolicy = "retry=3 min=disabled,disabled,disabled,12,8"
$Host1 = Get-VMHost | Where { $_.Name -eq "<host-ip>" }
$Host1 | Get-AdvancedSetting -Name "Security.PasswordQualityControl" | Set-AdvancedSetting -Value $PasswordPolicy -Confirm:$false

 

 VI Java API:

 

ServiceInstance si = new ServiceInstance(new URL("https://" + vcIPaddress + "/sdk"), userName, password, true);
HostSystem hs = (HostSystem) new InventoryNavigator(si.getRootFolder()).searchManagedEntity("HostSystem","<host-ip>");
OptionManager hom = hs.getOptionManager();
OptionValue[] ovArr = hom.getSetting();
String value = "retry=3 min=disabled,disabled,disabled,disabled,8";
for (OptionValue optionValue : ovArr) {
   if (optionValue.getKey().equals("Security.PasswordQualityControl")) {
		optionValue.setValue(value);
		hom.updateOptions(new OptionValue[] { optionValue });
		break;
   }
}

 

 
Reply
0 Kudos