Assumptions:
- You already have a TXT file on your computer that has a list of usernames for all the accounts
- You run these commands on a domain controller or a computer with the remote administration tools installed (to get the AD Module for PowerShell)
The Script:
Import-module activedirectory
$ErrorActionPreference="SilentlyContinue"
Stop-Transcript
| out-null
$ErrorActionPreference
= "Continue"
Start-Transcript
-path C:\output.txt -append
$list =
get-content c:\<path to the TXT file with your users in it>\users.txt
Foreach
($username in $list) {get-aduser -id $username -Properties passwordlastset
|select-object -property name,enabled,passwordlastset}
Stop-Transcript
Notes:
The "Start-Transcript" and "Stop-Transcript"enable you to get the output in a TXT file so you can import it in excel for later use and manipulation.
Good luck!!!
http://scriptquery.blogspot.in/
ReplyDeleteplease see my code also bro