active directory - How to retrieve All attributes of given user from given group in ActiveDirectory using VBScript? -
can me attributes of given user in given group active-directory using vb script .
on error resume next
set objgroup = getobject _ ("ldap://cn=domain admins,cn=users,dc=imts,dc=test") objgroup.getinfo arrmemberof = objgroup.getex("member") wscript.echo "members:" each strmember in arrmemberof wscript.echo strmember.distinguishedname next
this giving me users in group want attributes on given user
eg:
account_expires: account_name_history: cs_policyname: admin_count: admin_description: admin_displayname: allowedattributes: allowedattributeseffective: allowed_child_classes: allowedchildclasseseffective: altsecurityidentities: attributecertificateattribute: audio: bad_password_time: bad_pwd_count: bridge_head_serverlistbl: businesscategory: c: canonicalname: carlicense: co:
so on
note: sorry, i'm not in environment test , answer memory exercise. hope can help
you try query ldap schema user class
set oschema = getobject("ldap://schema/user")
then, can iterate on mandatoryproperties
, optionalproperties
collections storing retrieved values later check users these attributes
set oattributeslist = wscript.createobject("scripting.dictionary") each strattribute in oschema.mandatoryproperties oattributeslist.add strattribute, "" next each strattribute in oschema.optionalproperties oattributeslist.add strattribute, "" next
and once have full list, use getex
retrieve (as array) value of each of attributes each of users
set objgroup = getobject _ ("ldap://cn=domain admins,cn=users,dc=imts,dc=test") objgroup.getinfo arrmemberof = objgroup.getex("member") wscript.echo "members:" each strmember in arrmemberof set omember = getobject("ldap://" & strmember) each strattribute in oattributeslist.keys wscript.echo strattribute adata = omember.getex(strattribute) = 0 ubound(adata) wscript.echo "....: " & adata(i) next wscript.echo "" next next
Comments
Post a Comment