Forum Discussion
talobau
Jul 08, 2024Copper Contributor
Can't change PasswordExpirationPolicy of all users with Update-MgUser
Hello, Ive got into a problem where we disabled Password expiration in the GUI but some account keep having it enabled when you look with Powershell. Microsoft provides a guide where they explain...
- Jul 08, 2024
I found the solution for it
first you download a CSV file of every User in your tenant.
Get-MGuser -All -Property UserPrincipalName | Select-Object UserprincipalName | ConvertTo-Csv -NoTypeInformation | Out-File /Users/username/Downloads/UPN.csv
after you have that file you use it to scope all users in your tenant and apply the change
Import-Csv “/Users/username/Downloads/UPN.csv” | ForEach-Object{ $UserPrincipalName = $_.UserPrincipalName Update-MgUser -UserId $UserPrincipalName -PasswordPolicies DisablePasswordExpiration }
talobau
Jul 08, 2024Copper Contributor
I found the solution for it
first you download a CSV file of every User in your tenant.
Get-MGuser -All -Property UserPrincipalName |
Select-Object UserprincipalName |
ConvertTo-Csv -NoTypeInformation |
Out-File /Users/username/Downloads/UPN.csv
after you have that file you use it to scope all users in your tenant and apply the change
Import-Csv “/Users/username/Downloads/UPN.csv” | ForEach-Object{
$UserPrincipalName = $_.UserPrincipalName
Update-MgUser -UserId $UserPrincipalName -PasswordPolicies DisablePasswordExpiration }