Jump to content
Sign in to follow this  
Orts

How to get user profile information

Recommended Posts

Orts

Hi,

How can i run a recursive query against all users in AD to summerize thier user profile information >

Things like "Logon Script" path and home folder assisgnments

Thanks.

Or.

Share this post


Link to post
Share on other sites
BrettF
water

Search for adfunctions.au3 in the forum and then you could use something like

Global $sOU = "DC=microsoft,DC=com"
_ADGetObjectsInOU($asUser, $sOU, "(&(objectCategory=user)(department=" & $sDep & "))", 2, "department,cn,distinguishedName,sAMAccountName")

This returns department, cn, distinguishedName and sAMAccountName in array $asUser for every user in Department $sDep.

Use a tool like ADExplorer from Sysinternals to get an overview of your AD and the fields you can query. To narrow or widen your search you have to define a LDAP query. You'll find a lot of postings on how to create a LDAP query on this forum.

HTH

Thomas


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Orts

Search for adfunctions.au3 in the forum and then you could use something like

Global $sOU = "DC=microsoft,DC=com"
_ADGetObjectsInOU($asUser, $sOU, "(&(objectCategory=user)(department=" & $sDep & "))", 2, "department,cn,distinguishedName,sAMAccountName")

This returns department, cn, distinguishedName and sAMAccountName in array $asUser for every user in Department $sDep.

Use a tool like ADExplorer from Sysinternals to get an overview of your AD and the fields you can query. To narrow or widen your search you have to define a LDAP query. You'll find a lot of postings on how to create a LDAP query on this forum.

HTH

Thomas

Thanks, I've already checked the adfuntions.au3 but found no reference to HomeFolder or ScriptPath Values

Share this post


Link to post
Share on other sites
water

Use

_ADGetObjectsInOU($asUser, $sOU, "(&(objectCategory=user)(department=" & $sDep & "))", 2, "homeDirectory,scriptPath")
to get the Home Directory and the Logon Script.

If scriptPath doesn't return anything then your logon script might be defined in a group policy.

Use ADExplorer to check your AD - that's the only way to see what information you can pull from your AD.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.