Forum Discussion
ABill1
Oct 24, 2023Iron Contributor
How to change user passwords in bulk - without force to change
Hello everyone,
I'm in the process of updating the passwords for multiple users, and I'd like to set specific passwords of my choice. Additionally, I want to ensure that these accounts won't prompt users to change their passwords upon their first login.
I'd greatly appreciate your assistance, as the scripts I previously used are no longer effective.
I tried them however they didnt work anymore for me I had to use: Import-Csv ".\Sample7users.csv" -Delimiter "," -Encoding UTF8 | ForEach-Object {
$user = Get-AzureADUser -Filter "userPrincipalName eq '$($_.upn)'"
$secureString = ConvertTo-SecureString ($_.pw) -AsPlainText -Force
Set-AzureADUserPassword -ObjectId $user.ObjectID -Password $secureString -ForceChangePasswordNextLogin $false
}
- ABill1Iron Contributor
I tried them however they didnt work anymore for me I had to use: Import-Csv ".\Sample7users.csv" -Delimiter "," -Encoding UTF8 | ForEach-Object {
$user = Get-AzureADUser -Filter "userPrincipalName eq '$($_.upn)'"
$secureString = ConvertTo-SecureString ($_.pw) -AsPlainText -Force
Set-AzureADUserPassword -ObjectId $user.ObjectID -Password $secureString -ForceChangePasswordNextLogin $false
} - darlene22xxCopper ContributorHi ABill1,
To do bulk password reset, you need to create a CSV file where it should have a column preset with passwords, we will use this command, provided the column header is named “Password".
Import-Csv "C:\Users.csv" | % { Set-MsolUserPassword -userPrincipalName "$_.UserPrincipalName" -NewPassword "$_.Password" -ForceChangePassword $False
As you noticed, ForceChangePassword was set to false hence it should not force the users to change password the next time they sign in.