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
1 Answer
0
$Username = "samaccountname"
$ExpirationDate = (Get-Date).AddDays(1)
Set-ADUser -Identity $Username -AccountExpirationDate $ExpirationDate