Войти

Показать полную графическую версию : [решено] Дата смены пароля локального пользователя


dahiko
07-12-2015, 06:02
Всем привет!
Можно ли каким-нибудь образом выдернуть дату смены пароля локального пользователя (предпочтительнее bat или vbs)?

Iska
07-12-2015, 07:35
How To Find Password Last Changed Date Using ADSI (https://support.microsoft.com/en-us/kb/192949):
The Active Directory Service Interfaces (ADSI) Windows NT provider does not support the PasswordLastChanged Property of an IADsUser object. You can computer this date by subtracting the password expiration period from the password expiration date to get the last change date. Note that for users whose passwords never expire, the PasswordExpirationDate will be in the past and the computation still works correctly.
Option Explicit

Dim strUser


strUser = "UserName"

With GetObject("WinNT://./" & strUser & ",user")
WScript.Echo "Password Last Changed on : " & FormatDateTime(DateAdd("s", -.Get("MaxPasswordAge"), .PasswordExpirationDate))
End With

WScript.Quit 0

dahiko
07-12-2015, 10:53
Скрипт работает. Добавил еще ИМЯ пользователя в сообщение.

WScript.Echo "Password Last Changed on user "& strUser &": " & FormatDateTime(DateAdd("s", -.Get("MaxPasswordAge"), .PasswordExpirationDate))

Спасибо! Вопрос решен.




© OSzone.net 2001-2012