Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PowerShell: Change Active Directory User Password Expiration #PowerShell #ActiveDirectory
Import-Module ActiveDirectory
Get-ADGroupMember "F_Mitarbeiter ohne Arbeitsplatz" -Recursive |
Get-ADUser -Properties PasswordNeverExpires |
where {$_.enabled -eq $true -and $_.PasswordNeverExpires -eq $false} |
select -First 50 | %{
Write-Host $_.UserPrincipalName
Set-ADUser $_ -PasswordNeverExpires $true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.