- Joined
- Jan 19, 2011
- Messages
- 7,659
- Contests
- 0
- Reaction score
- 158
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:
View attachment 3470
2. Export the list:
To export the list add this to the end of the command.
In this example, I’m checking the date for user “robert.allen”.
In this example, I’ll get all users from my Management OU.
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.
Click on Scheduler and then click Add to create an automated report.
Link hidden, please Sign inor Sing up of the AD Pro Toolkit.
The toolkit’s Link hidden, please Sign inor Sing up includes over 200 built-in reports on users, computers, groups, and more.
Open the windows command prompt and type the command below.
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.
Link hidden, please Sign inor Sing up
[/QUOTE]
1. Open PowerShell:
Copy and paste the script below:
Code:
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")}}
View attachment 3470
2. Export the list:
To export the list add this to the end of the command.
Code:
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”.
Code:
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.
Code:
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.
Link hidden, please Sign in
The toolkit’s Link hidden, please Sign in
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.
Code:
Net user USERNAME /domain
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.
Link hidden, please Sign in
[/QUOTE]
