Difference between revisions of "Powershell Disable Password Expiration"
Jump to navigation
Jump to search
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...") |
Michael.mast (talk | contribs) |
||
Line 6: | Line 6: | ||
*This will disable password expiration, but for some reason also disables the account. | *This will disable password expiration, but for some reason also disables the account. | ||
− | <pre>get-aduser -filter * -Properties * | where {$_.office -match 'Some Office'} | Set-ADuser -Server bdc | + | <pre>get-aduser -filter * -Properties * | where {$_.office -match 'Some Office'} | Set-ADuser -Server bdc.domain.tld -PasswordNeverExpires $true</pre> |
*This will disable password expiration, but will leave the account enabled. | *This will disable password expiration, but will leave the account enabled. | ||
− | <pre>get-aduser -filter * -Properties * | where {$_.office -match 'Some Office'} | foreach { Set_Aduser -Server bdc | + | <pre>get-aduser -filter * -Properties * | where {$_.office -match 'Some Office'} | foreach { Set_Aduser -Server bdc.domain.tld -Identity $_.samaccountname -PasswordNeverExpires $true}</pre> |
Latest revision as of 13:20, 28 June 2019
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.domain.tld -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.domain.tld -Identity $_.samaccountname -PasswordNeverExpires $true}