tri_94 Posted January 16, 2019 Posted January 16, 2019 Hi there I'm after creating a script that will prompt for a username and then tell me when the password for that account is due to expire. I was planning on using something along these lines unless there is a better way I was working with Get-ADUser -Identity "$username" –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" but that doesn't seem to work for me. Any help would be great Thanks Nick #[system.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null #$UserName = [Microsoft.VisualBasic.Interaction]::InputBox("Enter User Name", "-UserName", "$UserName") Get-ADUser -Identity "User" –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}
MartinByard Posted January 16, 2019 Posted January 16, 2019 This works for me, what errors do you get when it runs? $user = Read-Host "Enter username to find Expiry date for:" Get-ADUser -Identity $user –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now