使用 LDAP 列出所有密码设置对象 (PSO)

发布于 2024-12-03 01:42:15 字数 367 浏览 0 评论 0原文

我应该如何继续获取特定域上的所有活动 PSO。

我知道该域包含以下 PSO:

CN=PSO-Standard
CN=PSO-Sensitive

但我必须创建一个报告来显示它们,因此我必须以动态方式加载它们。

我猜想有一种过滤器可以获取 PSO 容器,然后循环遍历其记录集。

例如,

.filter = "(CN=Password Settings Container)"

.attributes = "msDS-PasswordSettingsContainer"

提前致谢。

使用经典的 ASP 和 VBScript

how I should proceed to get all active PSOs on a specific domain.

I know that this domain contains the following PSOs:

CN=PSO-Standard
CN=PSO-Sensitive

But I must create a report to display them so I must load them in dynamic way.

I guess there is a kind of filter to get the PSO container and then loop through its recordset.

e.g.

.filter = "(CN=Password Settings Container)"

.attributes = "msDS-PasswordSettingsContainer"

thx in advance.

using classic asp with vbscript

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眸中客 2024-12-10 01:42:15

您正在寻找的过滤器是:“(objectClass=msDS-PasswordSettings)”

这是一个要测试的示例 Vbscript:

'==========================================================================
'
' NAME: SearchPSO.vbs
'
' AUTHOR: JPB , Silogix
' DATE  : 29/06/2011
'
' COMMENT: 
'
'==========================================================================
Option Explicit
Dim machine
Dim oRootDSE ' Root Directory Service Specific Entry
Dim DomainContainer ' The Roor of the Domain
Dim conn ' ADODB connexion
Dim ldapBase ' Base DN of the search
Dim ldapFilter ' Search filter
Dim ldapAttributes ' Attributs to get
Dim ldapScope ' Search scope
Dim ldapStr ' String to execute
Dim rs ' Search result
Dim f '
Dim oADSI ' ADSI access


' ADODB cooking
machine = "WM2008R2ENT"
Set oRootDSE = GetObject("LDAP://"&machine&"/"&"RootDSE")
DomainContainer = oRootDSE.Get("defaultNamingContext")

Set conn = CreateObject("ADODB.Connection")
conn.Provider = "ADSDSOObject"
conn.Properties("User ID") = "jpb"
conn.Properties("Password") = "test.2011"
conn.Properties("Encrypt Password") = True

conn.Open "ADs Provider"

' Building the request to exécute
ldapBase = "<LDAP://" & machine &"/"& DomainContainer & ">" 
ldapFilter = "(objectClass=msDS-PasswordSettings)"
ldapAttributes = "cn,msDS-LockoutDuration,msDS-MaximumPasswordAge"
ldapScope = "subtree"
ldapStr = ldapBase&";"&ldapFilter&";"&ldapAttributes&";"&ldapScope

' Search request execution
Set rs = conn.Execute(ldapStr)

' Restitution du résultat
While Not rs.EOF
  'For each f in rs.Fields
  '  WScript.Echo f.Name & ":" & f.Value
  'Next
  WScript.Echo rs.Fields("cn").Value
  rs.MoveNext
Wend

The filter you are looking for is : "(objectClass=msDS-PasswordSettings)"

Here is a sample Vbscript to test :

'==========================================================================
'
' NAME: SearchPSO.vbs
'
' AUTHOR: JPB , Silogix
' DATE  : 29/06/2011
'
' COMMENT: 
'
'==========================================================================
Option Explicit
Dim machine
Dim oRootDSE ' Root Directory Service Specific Entry
Dim DomainContainer ' The Roor of the Domain
Dim conn ' ADODB connexion
Dim ldapBase ' Base DN of the search
Dim ldapFilter ' Search filter
Dim ldapAttributes ' Attributs to get
Dim ldapScope ' Search scope
Dim ldapStr ' String to execute
Dim rs ' Search result
Dim f '
Dim oADSI ' ADSI access


' ADODB cooking
machine = "WM2008R2ENT"
Set oRootDSE = GetObject("LDAP://"&machine&"/"&"RootDSE")
DomainContainer = oRootDSE.Get("defaultNamingContext")

Set conn = CreateObject("ADODB.Connection")
conn.Provider = "ADSDSOObject"
conn.Properties("User ID") = "jpb"
conn.Properties("Password") = "test.2011"
conn.Properties("Encrypt Password") = True

conn.Open "ADs Provider"

' Building the request to exécute
ldapBase = "<LDAP://" & machine &"/"& DomainContainer & ">" 
ldapFilter = "(objectClass=msDS-PasswordSettings)"
ldapAttributes = "cn,msDS-LockoutDuration,msDS-MaximumPasswordAge"
ldapScope = "subtree"
ldapStr = ldapBase&";"&ldapFilter&";"&ldapAttributes&";"&ldapScope

' Search request execution
Set rs = conn.Execute(ldapStr)

' Restitution du résultat
While Not rs.EOF
  'For each f in rs.Fields
  '  WScript.Echo f.Name & ":" & f.Value
  'Next
  WScript.Echo rs.Fields("cn").Value
  rs.MoveNext
Wend
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文