如何强制执行A​​ctive Directory密码复杂性

时间:2018-07-26 20:05:03

标签: powershell active-directory

根据this article,使用PowerShell或cmd,我要强制用户具有特定的密码要求。我尝试在secedit中编辑配置文件。

secedit /export /cfg c:\secpol.cfg
$min_pass_regex = "MinimumPasswordLength = \d+"
$min_pass_length = 10
$min_pass_requirement = "MinimumPasswordLength = $($min_pass_length)"

(gc C:\secpol.cfg).replace("RequireLogonToChangePassword = 0", "RequireLogonToChangePassword = 1") | Out-File C:\secpol.cfg
(gc C:\secpol.cfg).replace("PasswordComplexity = 0", "PasswordComplexity = 1") | Out-File C:\secpol.cfg
(gc C:\secpol.cfg) -replace $min_pass_regex, $min_pass_requirement | Out-File C:\secpol.cfg
cat C:\secpol.cfg
secedit /configure /db c:\windows\security\local.sdb /cfg c:\secpol.cfg /areas SECURITYPOLICY

但是,即使重新启动,用户也不会收到警告以创建更安全的密码。如何执行此政策?

0 个答案:

没有答案