Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   Скриптовые языки администрирования Windows (http://forum.oszone.net/forumdisplay.php?f=102)
-   -   [решено] Дата смены пароля локального пользователя (http://forum.oszone.net/showthread.php?t=308874)

dahiko 07-12-2015 06:02 2582258

Дата смены пароля локального пользователя
 
Всем привет!
Можно ли каким-нибудь образом выдернуть дату смены пароля локального пользователя (предпочтительнее bat или vbs)?

Iska 07-12-2015 07:35 2582265

How To Find Password Last Changed Date Using ADSI:
Цитата:

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 2582299

Скрипт работает. Добавил еще ИМЯ пользователя в сообщение.

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

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


Время: 15:32.

Время: 15:32.
© OSzone.net 2001-