How to set AD user account expiration date in powershell using only samaccount name | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to set AD user account expiration date in powershell using only samaccount name

17th Jun 2022, 2:15 PM
Kavitha AV
1 Answer
0
$Username = "samaccountname" $ExpirationDate = (Get-Date).AddDays(1) Set-ADUser -Identity $Username -AccountExpirationDate $ExpirationDate
14th Apr 2023, 6:20 AM
Serhii Dubynskyi
Serhii Dubynskyi - avatar