请教一下下面的代码。
Set objDomainNT = GetObject("WinNT://APAC")
intMaxPwdAge = objDomainNT.Get("MaxPasswordAge")
intMaxPwdAge = 86400
intMaxPwdAge = (intMaxPwdAge / 86400)
Const ADS_ACETYPE_ACCESS_DENIED_OBJECT = &H6
Const CHANGE_PASSWORD_GUID = "{ab721a53-1e2f-11d0-9819-00aa0040529b}"
Const urlGroupWWW = "LDAP://cn=RB_InternetUser_CN_GW,cn=Builtin, dc=cn, dc=bosch, dc=com"
'Set wwwItems = GetObject(urlGroupWWW)
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 100
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "SELECT samAccountName, ADsPath FROM 'GC://ou=Useraccounts, ou=sgh, dc=apac, dc=bosch,dc=com'"
objCommand.Properties("SearchScope") = ADS_SCOPE_SUBTREE
Set objrecordset = objCommand.Execute
objrecordset.MoveFirst
VBA里的代码
我想知道上面的到底获取了哪里数据库的数据?我该怎么打开上面的数据库。实在不太会。
小弟纯新手哈。
[最优解释]
Active Directory 是储存用户和计算机账户的地方,那么这段代码的意思就一目了然了.
具体参考
http://www.microsoft.com/china/technet/community/columns/scripts/sg0405.mspx
[其他解释]
感谢xiaolinyouni 提供这么好的学习内容。
说实话直接在网上搜找不到应该学点什么。先去学习学习。
[其他解释]
我大概已经知道你是哪个了。。这段代码是无锡的陈海峰写的,你可以问他