Ad Password Expiration query

Source: Internet
Author: User
Tags samaccountname

1, query whether a single account expires: You can use the command net user%USERNAME%/domain to query. Here's how it works:

2. Query the ad account password expiration time for all active: Run the PowerShell tool on AD domain control.

The first step is to enter:

$maxPasswordAge = (get-addefaultdomainpasswordpolicy). Maxpasswordage.days

Enter the second step:

Get-aduser-filter {enabled-eq $True-and passwordneverexpires-eq $False}–properties * |
Select-object-property "Displayname", @{n= "expirydate"; e={$_. Passwordlastset.adddays ($maxPasswordAge)}}

Returns the expiration date for all AD accounts in this domain after a carriage return.

3, through the script to query the ad account for a period of time expired status:

1, in the C-drive path to create a script folder within the placement of scripts getaduserpasswordexpiration.psm1, files in this document attachment. After the power shell is executed by an administrator:

The first method:

First step input:import-module C:\Script\GetADUserPasswordExpiration.psm1

Second Step input:get-oscaduserpasswordexpiration-samaccountname "Doris", "Katrina"-nextday

Note: Doris,katrina is the user account information in the ad domain, which can be modified according to the actual situation.

The second method:

Create a file named Samaccountname.csv in the Script folder under the C-drive path, and open it in the folder by using TXT to save the account information like the following format, the specific account name is subject to actual.

First step input:import-module C:\Script\GetADUserPasswordExpiration.psm1

Step Two input: Get-oscaduserpasswordexpiration–csvfilepath C:\Script\SamAccountName.csv-NextDay 10

The example diagram is as follows:

Data Source:

1. To inquire whether a single account has expired, you can use the following command: NET user%USERNAME%/domain

2. Check the expiration time of all active ad account passwords:

One-liner:get a List of AD Users Password expiry Dates

Http://blogs.technet.com/b/poshchap/archive/2014/02/21/get-a-list-of-ad-users-39-password-expiry-dates.asp

RELATED links:

How to Find when A User Password Expires?

https://theucguy.net/how-to-find-when-a-user-password-expires/

How to check if Active Directory user password are expired on specified days

Https://gallery.technet.microsoft.com/scriptcenter/How-to-check-if-Active-f27b7d39

Note: script for this tool, 22208 for the initial script information can also be used with a little editing.

Ad Password Expiration query

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.