是否 win32安全.登录用户() 更新上次登录时间戳



我正在编写一个 Python 脚本,该脚本将自动从列表中登录用户。此脚本将每月运行一次,以防止帐户因活动不足而被禁用。以下是工作代码:

import win32security
import getpass
accounts = {'user1':'password1', 'user2':'password2', 'user3':'password3'}
for username, password in accounts.items():
    handle = win32security.LogonUser(username, "DOMAIN", password, win32security.LOGON32_LOGON_INTERACTIVE, win32security.LOGON32_PROVIDER_DEFAULT)
    print username.upper() + ': ' + repr(bool(handle))
    handle.close()

我的问题是,win32安全会安全吗?LogonUser() 更新 Active Directory 中的"上次登录"时间戳?有没有另一种方法可以在不拥有活动目录服务器的管理权限的情况下实现此目的?

谢谢

沃尔

您正在进行的交互式登录调用应更新此内容。即使具有管理权限,也无法手动更新值,但仅供参考。

任何交互式登录、文件服务访问或交换服务器访问都将更新 LastLogon,从而更新 LastLogonTimestamp,该时间戳由 DS Server 管理,并保持在 10 天内的准确性。

最新更新