Skip to content

Instantly share code, notes, and snippets.

@janikvonrotz
Created December 11, 2013 16:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janikvonrotz/7913696 to your computer and use it in GitHub Desktop.
Save janikvonrotz/7913696 to your computer and use it in GitHub Desktop.
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