Powershell Disable Password Expiration

From Michael's Information Zone
Revision as of 13:19, 28 June 2019 by Michael.mast (talk | contribs) (Created page with "==Purpose== To disable password expiration for everyone from a given office. ==Process== *This will disable password expiration, but for some reason also disables the accoun...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose

To disable password expiration for everyone from a given office.

Process

  • This will disable password expiration, but for some reason also disables the account.
get-aduser -filter * -Properties * |  where {$_.office -match 'Some Office'} | Set-ADuser -Server bdc-michael-csp -PasswordNeverExpires $true
  • This will disable password expiration, but will leave the account enabled.
get-aduser -filter * -Properties * |  where {$_.office -match 'Some Office'} | foreach { Set_Aduser -Server bdc-michael-csp -Identity $_.samaccountname  -PasswordNeverExpires $true}