powershell problem with expired passwords

I have a problem with getting the correct password expire date form an active directory:

I need to notify users in timely fashion on expired passwords , so i found a script which worked for other customers:

https://gallery.technet.microsoft.com/Password-Expiry-Email-177c3e27

with this customer i get a few valid values back but not the user which I'm expecting (one who has to change the password in 2 days from now)

with the command net user [username] /domain

i get the values for this user:
Password last set            7/24/2015 11:17:56 AM
Password expires             9/4/2015 11:17:56 AM
Password changeable          7/24/2015 11:17:56 AM

when i run a powershell script:

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed"|Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

i get the following output for the same user:
Displayname                             ExpiryDate
-----------                                      ----------
[display name user]                  1/1/1601 1:00:00 AM

so is'clear from the powershell command the paswword will not expire and the script wont sent the email to this user

I'm pretty sure i'm missing something. where comes the difference from in the net user command and the powershell script
and what can i do to solve this ?
Mirjam BlockInfrastructure Specialist and Project ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LearnctxEngineerCommented:
A return value of 1/1/1601 is normal for a user whose password has been set to expire at next logon. Excluding users with expired passwords.

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties PasswordExpired, DisplayName, msDS-UserPasswordExpiryTimeComputed | ? {$_.PasswordExpired -eq $false} | Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} 

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mirjam BlockInfrastructure Specialist and Project ManagerAuthor Commented:
could it be that i get that value when i'm allowed to change the password ?

in the net user command i get a different date than the 1/1/1601 value. do i look at the wrong field with my powershell command ?
Will SzymkowskiSenior Solution ArchitectCommented:
This is not specifically related to your question however i would recommened using Manage Engines Free Password Notifier. For notifying users when their password are going to expire.

https://www.manageengine.com/products/self-service-password/free-password-expiry-notification-tool.html

Will.
Mirjam BlockInfrastructure Specialist and Project ManagerAuthor Commented:
The manageengine solution looks promising;

the comment about the 1601 for expired passords gave me some insight in the way some things work.

my problem is not solved completely but i have some options

Many Thanks !
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.