Hi,
I am trying to obtain by script both the DisplayName and values created for Citrix PasswordManager from ADSI.
Password manager creates values against the user as a new branch under the user, as opposed to a property for that user. For Example:
OU=MyOU --> CN=MyUserName --> CN=SSORegistry.
There are other records at the same level as CN=SSORegistry. Some of the names for these records change per user.
The script needs to retrieve all these records for each user that has an entry. FYI, these records are created when a user has set up their Citrix Password Manager self-service.
The code I have so far lists all the items, but I cannot get it to pull the DisplayName.
The distinguishedName field for some of the records returned may include the dn for the user:
CN=QBA2EnrollReg,CN=FirstName Surname,OU=someOU,OU=Managers,OU=Users,DC=myDomain,DC=co,DC=uk
, so I could do some string manipulation to return just the DisplayName. But this is not foolproof as the records are not always the same.
Any pointers would be gratefully received.
Many thanks
W
I am trying to obtain by script both the DisplayName and values created for Citrix PasswordManager from ADSI.
Password manager creates values against the user as a new branch under the user, as opposed to a property for that user. For Example:
OU=MyOU --> CN=MyUserName --> CN=SSORegistry.
There are other records at the same level as CN=SSORegistry. Some of the names for these records change per user.
The script needs to retrieve all these records for each user that has an entry. FYI, these records are created when a user has set up their Citrix Password Manager self-service.
The code I have so far lists all the items, but I cannot get it to pull the DisplayName.
Code:
iterateAD
Sub iterateAD()
'On Error Resume Next
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
Set objRootDSE = GetObject("LDAP://RootDSE")
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT Name, distinguishedName FROM 'LDAP://" & objRootDSE.Get("defaultNamingContext") & "' WHERE objectClass='citrix-SSOSecret' "
Set objRootDSE = Nothing
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("Name").Value & vbTab & objRecordSet.Fields("distinguishedName").Value
objRecordSet.MoveNext
Loop
End Sub
The distinguishedName field for some of the records returned may include the dn for the user:
CN=QBA2EnrollReg,CN=FirstName Surname,OU=someOU,OU=Managers,OU=Users,DC=myDomain,DC=co,DC=uk
, so I could do some string manipulation to return just the DisplayName. But this is not foolproof as the records are not always the same.
Any pointers would be gratefully received.
Many thanks
W