I don't know much about scripting at all, but want to help out my lead with something. I'm trying to create a script that will ask for a username and it will return when their password will expire in AD. I also want to continue inputting usernames after it has finished in case there are multiple users I need to check. Below is the script I have so far.
$User = Read-Host "Username?"
Get-ADUser $User -Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" |
Select-Object -Property "Displayname", @{Name = "ExpiryDate"; Expression = {[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}
I was looking into doing loops, but I do not know how to write it out. Any help would be appreciated. Thanks.