interiorsfor.blogg.se

Powershell set account expiration date
Powershell set account expiration date







Set-ADUser -server $DC -Identity "$ID" -Replace that helps. # according to the maximum password age policy that applies to the user. # datetime the next time the user logs on. But the system will assign a value corresponding to the current # can be saved in a LargeInteger attribute. # the way 64-bit integers are saved, this is the largest possible value that Set-ADUser -Server $DC -Identity "$ID" -Replace Assign -1 to the pwdLastSet attribute for all users in the CSV. # $ID is in quotes because the sAMAccountName can include spaces. # Assign 0 to the pwdLastSet attribute for all users in the CSV. The bit that does the extending is copied below The script we started from can be found at We couldn't find a way to set the expiration date but did find a script that effectively removes expiration until the next time they login (at which point expiration becomes your standard value). The value msDS-UserPasswordExpiryTimeComputed contains the user's password expiration date. Then we ask for specific properties to return we need the EmailAddress for later on. We did something similar for a group of accounts a few months ago. Two examples would be to target a specific organizational unit (OU) or maybe a set of accounts that match a name (such as admin accounts).









Powershell set account expiration date