Determine password expiry date
I have a Windows XP system and the user accounts are configured to have their passwords expire in 45 days option set. I am trying to figure out, either manually or via the use of a batch file, what the password expiry date is based on the 开发者_StackOverflowcurrent user logged in. I know that there are VBScript files that can accomplish this, but these pc's are configured to not execute VBScript files, therefore I need to either look this up manually or batch files.
Thanks!
If this is just on one computer, one user, and ran locally...
net user username | findstr "expires"
Multiple machines ran remotely for one user account... put all computer names or IP's in a text file (i.e. systems.txt)
psexec @systems.txt net user username | findstr "expires"
psexec is free from sysinternals
If you want to know the expiration date on all local users on multiple network computers you can use powershell and psexec (remote machines do not require powershell), like so...
$systems = get-content .\systems.txt;
foreach ($sys in $systems) {
foreach ($token in (Get-WmiObject Win32_UserAccount -ComputerName $sys -Filter "Domain='$sys'" | Select-Object -Property Name |ft -AutoSize -HideTableHeaders >> "$sys.txt")) { echo $token };
(cat "$sys.txt") -replace ' {2,}','' | ? {$_ -ne ''} | sc "$sys.txt"
foreach ($strUser in (get-content "$sys.txt")) {psexec \\$sys net user $strUser >> "$sys-accounts.txt"
}
}
you may need to tweak the script a little... hope this helps.
精彩评论