powershell disable password complexity 1

powershell disable password complexity

secedit /export /cfg c:\secpol.cfg
(gc C:\secpol.cfg).replace("PasswordComplexity = 1", "PasswordComplexity = 0") | Out-File C:\secpol.cfg
secedit /configure /db c:\windows\security\local.sdb /cfg c:\secpol.cfg /areas SECURITYPOLICY
rm -force c:\secpol.cfg -confirm:$false

Here is what the above code is Doing:
1. It’s creating a new file called secpol.cfg in the root of the C: drive.
2. It’s exporting the current security policy to that file.
3. It’s replacing the value of PasswordComplexity from 1 to 0.
4. It’s importing the new security policy from the secpol.cfg file.
5. It’s deleting the secpol.cfg file.

Similar Posts