Bodman Posted April 4, 2011 Posted April 4, 2011 Can anyone help, I am trying to export the telephone numbers for a list of users in AD using _AD_GetObjectsInOU I can get the list to export to a array, but I cant get the info from the array into a string. Can you see where im going wrong. #include <ad.au3> _AD_Open() Global $sOU = "OU=Users,OU=C3048090,OU=SKE,OU=GB,OU=EU,DC=ecdomain,DC=net" Global $aResult = _AD_GetObjectsInOU($sOU,"(&(objectCategory=person)(objectClass=user)(mail=*))",2,"telephoneNumber,samAccountName") _ArrayDisplay($aResult) MsgBox(0, "_ArrayToString()", _ArrayToString($aResult)) _AD_Close() Thanks Bod
water Posted April 4, 2011 Posted April 4, 2011 _AD_GetObjectsInOU returns a 2-dimensional array, _ArrayToString can only handle 1-dimensional arrays. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Bodman Posted April 4, 2011 Author Posted April 4, 2011 _AD_GetObjectsInOU returns a 2-dimensional array, _ArrayToString can only handle 1-dimensional arrays. thanks for your reply.....is there anyway I can export a users phone number to a string then
water Posted April 4, 2011 Posted April 4, 2011 (edited) You directly access the element in the array. $aResult[1][0] is the telephoneNumber of the first user, $aResult[1][1] is samAccountName and so on ... Edited April 4, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Bodman Posted April 4, 2011 Author Posted April 4, 2011 You directly access the element in the array. $aResult[1][0] is the telephoneNumber of the first user, $aResult[1][1] is samAccountName and so on ... do you mean like this MsgBox(0, "_ArrayToString()", _ArrayToString($aResult[1][0])) as im still getting a blank...sorry arrays confuse the hell out of me
water Posted April 4, 2011 Posted April 4, 2011 (edited) Try MsgBox(0, "_ArrayToString()", $aResult[1][0])The content of an array element is always a string.To understand how arrays work please have a look here. Edited April 4, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Bodman Posted April 4, 2011 Author Posted April 4, 2011 Try MsgBox(0, "_ArrayToString()", $aResult[1][0]) The content of an array element is always a string. To understand how arrays work please have a look here. Thank you Ive spent ages banging my head with this. I really appreciate your help (again) Bod
water Posted April 4, 2011 Posted April 4, 2011 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now