Active Directory kullanıcılara toplu olarak şifre verilmesi
PS:
############################################################################### ############################################################################### #Method 1 Import-Module ActiveDirectory #Kullanıcı bigilerini ve passwordleri içeri al ve oku $Resetpassword = Import-Csv "C:\parolasifirla.csv" foreach ($Account in $Resetpassword) { $Account.sAMAccountName $Account.Password Set-ADAccountPassword -Identity $Account.sAMAccountName -NewPassword (ConvertTo-SecureString $Account.Password -AsPlainText -force) -Reset } ########################################################################### ########################################################################### #Method 2 Import-Module ActiveDirectory #Yeni şifreyi belirleyin $newPassword = ConvertTo-SecureString -AsPlainText “Password45++” -Force #Kullanıcı bigilerini içeri al ve oku Import-Csv "C:\parolasifirla.csv" | ForEach-Object { $samAccountName = $_."samAccountName" #Kullanıcı şifresini sıfırlayın. Set-ADAccountPassword -Identity $samAccountName -NewPassword $newPassword -Reset # "Sifreyi Oturum Açmada Degistir" seçenegini devre disi birak/aktif et Set-AdUser -Identity $samAccountName -ChangePasswordAtLogon $true Write-Host " AD Password has been reset for: "$samAccountName } ########################################################################### ########################################################################### #Method 3 # Active Directory modülünü içe aktar Import-Module ActiveDirectory # Yeni sifreyi ayarla $newPassword = ConvertTo-SecureString -AsPlainText "Passwd599+" -Force # CSV dosyasindan kullanicilari içe aktar $csvPath = "C:\Kayitlar\user_page.csv" $users = Import-Csv $csvPath # CSV içindeki her kullanici için ayarlari güncelle foreach ($user in $users) { $samAccountName = $user."samAccountName" # Kullaniciyi Active Directory'de bul $userObj = Get-ADUser -Filter {SamAccountName -eq $samAccountName} if ($userObj) { # Kullanici için yeni sifreyi ayarla Set-ADAccountPassword -Identity $userObj -NewPassword $newPassword -Reset # "Sifreyi Oturum Açmada Degistir" seçenegini devre disi birak/aktif et Set-ADUser -Identity $userObj -ChangePasswordAtLogon $false Write-Host "$samAccountName için sifre ve 'Sifreyi Oturum Açmada Degistir' güncellendi." } else { Write-Host "Active Directory'de $samAccountName kullanicisi bulunamadi." } } ########################################################################### ###########################################################################
virgülle ayrılmış - comma separated .csv file örneği
This post is licensed under CC BY 4.0 by the author.