Last active
December 24, 2024 13:42
-
-
Save themaximax/74936c6e608d29d086402e4670c86278 to your computer and use it in GitHub Desktop.
Скрипт для отключения полики сложности и длины паролей. Может пригодиться, когда комп уже введёт в домен, а нужно создать/изменить ограниченную локальную учётку
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # !скрипт запускать от имени администратора | |
| # куда сохранять | |
| $file = Join-Path -Path $env:TEMP -ChildPath 'sec.inf' | |
| # экспортируем параметры безопасности в файл | |
| SecEdit.exe /export /cfg $file | |
| # читаем файл в переменную | |
| $content = Get-Content $file | |
| # меняем значения ключей, с помощью регулярного выражения | |
| $content = $content -replace '^(PasswordComplexity|MinimumPasswordLength).*', '$1 = 0' | |
| # пишем обратно в файл | |
| Set-Content -Path $file -Value $content | |
| # импортируем измененные политики | |
| SecEdit.exe /configure /db $env:windir\security\edit.sdb /cfg $file /areas SECURITYPOLICY | |
| # удаляем за собой | |
| Remove-Item -Force $file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment