Last active
July 17, 2025 12:34
-
-
Save boranbar/d3f9eb649d9d490ba94997d6baec7773 to your computer and use it in GitHub Desktop.
PowerShell Script to Modify Password Policy and Create Local Administrator Users
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
| # Parola politikalarını düzenle | |
| secedit /export /cfg "$env:TEMP\secpol.cfg" | |
| (gc "$env:TEMP\secpol.cfg") | | |
| ForEach-Object { | |
| $_ -replace 'PasswordComplexity\s*=\s*\d+', 'PasswordComplexity = 0' ` | |
| -replace 'MinimumPasswordLength\s*=\s*\d+', 'MinimumPasswordLength = 0' | |
| } | Set-Content "$env:TEMP\secpol.cfg" | |
| secedit /configure /db secedit.sdb /cfg "$env:TEMP\secpol.cfg" /areas SECURITYPOLICY | |
| # Grup ilkesi güncelle | |
| gpupdate /force | |
| Start-Sleep -Seconds 3 | |
| # Kullanıcı listesi (kullanıcı adı ve şifre) – Administrator hariç | |
| $users = @{ | |
| "ALI" = "123456" | |
| "VELI" = "123456.." | |
| "HASAN" = "123456xxx" | |
| "HUSEYIN" = "123456asdasd" | |
| } | |
| # Kullanıcıları oluştur ve yöneticilere ekle | |
| foreach ($user in $users.Keys) { | |
| $username = $user | |
| $password = $users[$user] | ConvertTo-SecureString -AsPlainText -Force | |
| # Kullanıcıyı oluştur (eğer yoksa) | |
| if (-Not (Get-LocalUser -Name $username -ErrorAction SilentlyContinue)) { | |
| New-LocalUser -Name $username -Password $password -FullName $username | |
| Write-Host "Kullanıcı oluşturuldu: $username" | |
| } else { | |
| Write-Host "Kullanıcı zaten mevcut: $username" | |
| } | |
| # Yöneticilere ekle | |
| Add-LocalGroupMember -Group "Administrators" -Member $username -ErrorAction SilentlyContinue | |
| Write-Host "Yönetici grubuna eklendi: $username" | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🛠️ How to Use
Create the script file
Save the PowerShell script as
create_users.ps1on your Desktop.Run the script
Open PowerShell as Administrator and execute the following commands:
✔️ This will: