-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbulk_pw_reset.ps1
18 lines (18 loc) · 917 Bytes
/
bulk_pw_reset.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Import-Module ActiveDirectory
$users = Get-Content ###DOSYA YOLU###
$Output = foreach ($user in $users) {
$kAdi = Get-ADUser -Identity $user -Properties sAMAccountName | Select -ExpandProperty sAMAccountName
$name = Get-ADUser -Identity $user -Properties Name | Select -ExpandProperty Name
$pw = Get-ADUser -Identity $user -Properties idNo | Select -ExpandProperty idNo
$parola = "par0l4" + $pw.Substring($pw.Length -4, 4)
$password = ConvertTo-SecureString $parola -AsPlainText -Force
Set-ADAccountPassword -Identity $user -NewPassword $password
Set-ADUser -Identity $user -ChangePasswordAtLogon $false
New-Object -TypeName PSObject -Property @{
kullaniciAdi = $kAdi
parola = $parola
tckimlikNo = $pw
isimSoyisim = $name
} | Select-Object isimSoyisim, kullaniciAdi, tckimlikNo, parola
}
$Output | Export-Csv ###CIKTI DOSYASI###