Password change details

Glenn Maxwell 10,146 Reputation points
2021-07-14T04:50:30.9+00:00

Hi All

i have 10 AD accounts in csv file, i want to get the below information..

Password last set
Password expires
Password changeable
Password required
User may change password

if i use this syntax for one user net user user1 /domain i am able to fetch the information.
i want to import the csv file and export the above information. please guide me. my csv file is in below format

users
user1@Company portal .com
user2@Company portal .com

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,458 questions
Windows Server 2016
Windows Server 2016
A Microsoft server operating system that supports enterprise-level management updated to data storage.
2,371 questions
Windows Server 2012
Windows Server 2012
A Microsoft server operating system that supports enterprise-level management, data storage, applications, and communications.
1,529 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,127 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,854 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,651 Reputation points Microsoft Vendor
    2021-07-14T07:28:17.1+00:00

    Hi,

    You can try some PowerShell script like this.

    $userfile = "C:\temp\user.csv"  
    $infofile = "C:\temp\info.txt"  
    Import-Csv -Path $userfile | ForEach-Object {  
        $_.users  
        $pattern = [regex]::new('^.+(?=@)')  
        $user=$pattern.Matches($_.users).Value  
        net user $user /domain | Where-Object {$_ -match "Password"}  
        ""  
    } | Out-File -FilePath $infofile  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful