In this example, I’ll use the get-aduser PowerShell cmdlet to get all users password expiration date.
1. Open PowerShell:
Copy and paste the script below:
Код:Скопировать
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")}}
Посмотреть вложение 3470
2. Export the list:
To export the list add this to the end of the command.
Код:Скопировать
export-csv -path c:\temp\passwordexpiration.csv
How to Check Password Expiration Date for a Single User To get the password expiration date for a specific user run this command.
In this example, I’m checking the date for user “robert.allen”.
Код:Скопировать
Get-ADUser -identity robert.allen –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" |
Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}
Get Password Expiration Date for Users in an Organizational Unit To get only users in an OU you will need to use the -SearchBase option and the distinguishedName of the OU.
In this example, I’ll get all users from my Management OU.
Код:Скопировать
Get-ADUser -filter * -SearchBase "OU=Management,OU=ADPRO Users,DC=ad,DC=activedirectorypro,DC=com" –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}
Get Passwords Expiring in the Next 30 Days With the AD Pro Toolkit, you can choose a time frame for when passwords will be expiring.
Click the Time button and choose the time frame.
Now you will see a list of users that that has a password expiring in the next 30 days.
Password Expiration Email Notification To get an automated email report of password expiration dates use the built in task scheduler.
Click on Scheduler and then click Add to create an automated report.
Для просмотра ссылки Войди или Зарегистрируйся of the AD Pro Toolkit.
The toolkit’s
Для просмотра ссылки Войди или Зарегистрируйся includes over 200 built-in reports on users, computers, groups, and more.
Using the Net User command to Display Password expiresDate This last method uses the built in net user command to display a users password expiration date. This is useful to quickly check the password expires date for a single domain user account.
Open the windows command prompt and type the command below.
Код:Скопировать
Net user USERNAME /domain
In this example, I’ll use the account robert.allen.
In addition to displaying the password expires date it also provides other useful information such as password last set, when the password can be changed if the account is active, and so on.
Для просмотра ссылки Войди или Зарегистрируйся
[/QUOTE]