PowerShell AD

Associate
Joined
4 Feb 2011
Posts
580
Location
Halifax
Not a powershell pro by any means but something like this should work, obviously changing the OU/DC.

Code:
Import-Module ActiveDirectory  
 $users = $i = $null  
 $users = Get-ADUser - Filter * -SearchBase "ou=ou,dc=dc" 
 ForEach($user in $users)  
  {  
    "modifying $($user.name)"  
    Clear-ADAccountExpiration -Identity $user
    $i++  
 }  
"modified $i users"
 

Bry

Bry

Associate
Joined
24 Jul 2005
Posts
1,374
Can be done much simpler:

get-aduser -filter * -ResultSetSize $null| Clear-ADAccountExpiration -whatif

will show you what it will do, take whatif off to actually do the action

get-aduser -filter * -ResultSetSize $null| Clear-ADAccountExpiration
 
Last edited:
Back
Top Bottom