Retrieves user account attributes found on the Organization page of the user account object in Active Directory Users and Computers.
On Error Resume NextSet objUser = GetObject _("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")objUser.GetInfostrTitle = objUser.Get("title")strDepartment = objUser.Get("department")strCompany = objUser.Get("company")strManager = objUser.Get("manager")strDirectReports = _objUser.GetEx("directReports")WScript.echo "title: " & strTitleWScript.echo "department: " & strDepartmentWScript.echo "company: " & strCompanyWScript.echo "manager: " & strManagerFor Each strValue in strDirectReportsWScript.echo "directReports: " & strValueNext
This is a VB Script, this can be used by saving the file in .vbs file