大网数据广告活动
域与目录服务

WinNT Custom User Properties

· 52CE 我爱测

The WinNT provider makes available the following custom properties for the User class. They may be accessed through the IADs.Get and IADs.Put methods. For more information, see the USER_INFO_3 structure.

The WinNT provider makes available the following custom properties for the User class. They may be accessed through the IADs.Get and IADs.Put methods. For more information, see the USER_INFO_3 structure.

Property Type Description
HomeDirDrive String Home Directory Drive of the user. This is a pointer to a Unicode string that specifies the path of the home directory. The string can be null. See example in this topic.
ObjectSID Octet String Object SID of the user. For an example of how to retrieve the Object SID using the WinNT Provider, see Object SID (WinNT Provider)
Parameters String Parameters of the user. Points to a Unicode string that is set aside for use by applications. This string can be a null string, or it can have any number of characters before the terminating null character. Microsoft products use this member to store user configuration data. This property can only be modified by an application during installation.
PasswordAge Time Time duration of the password in use. This property indicates the number of seconds that have elapsed since the password was last changed.
PasswordExpired Integer Tells when the password was expired. When you use Get, it will return zero is the password has not expired, or nonzero if it has expired. See example in this topic.
PrimaryGroupID Integer User's primary group ID, for example, domain user group ID. See example in this topic.
UserFlags Integer User Flag defined in ADS_USER_FLAG_ENUM. For an example of how to use UserFlags, see Password Never Expires (WinNT Provider)

This example shows how to set a user's Home Drive Directory.

Dim usr As Object

Set usr = GetObject("WinNT://Fabrikam/jsmith,user") 
usr.HomeDirectory = "UserHomeDirHere"
usr.HomeDirDrive = "HomeDirDriveHere"
usr.SetInfo

This example shows how to use PasswordExpired to force a user to change the password at the next logon.

Dim usr As Object

Set usr = GetObject("WinNT://Fabrikam/jsmith,user")
usr.Put "PasswordExpired", CLng(1)
usr.SetInfo 

'--- Clear this flag so that the user does not have to change the password at next logon.

usr.Put "PasswordExpired", CLng(0)
usr.SetInfo

This example shows how to get the user's primary group.

Dim usr As Object
Dim grpPrimaryID As Object

Set usr = GetObject("WinNT://Fabrikam/jsmith,user") 
grpPrimaryID = usr.Get("PrimaryGroupID")

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。