darkleton Posted March 23, 2010 Share Posted March 23, 2010 (edited) This should just display all user accounts on the whole AD tree shouldn't it?_AD_Open() $arUsers = _AD_GetObjectsInOU("", "(&(objectclass=user)(name=*))", 2, "sAMAccountName", "sAMAccountName") _ArrayDisplay($arUsers) _AD_Close()I have tried changing objectclass to other things, changing the last two to "cn" or "displayname" but every time it just returns a 1501 line array, with the first line stating "1501" and the rest blank. Other commands like _AD_GetAllOUs works fine and will display all the OUs in an array nicely. Am I doing something stupidly wrong? Edited March 23, 2010 by darkleton Link to comment Share on other sites More sharing options...
99ojo Posted March 23, 2010 Share Posted March 23, 2010 (edited) Hi,this code works, although not as expected, because i get also the computeraccounts:#include <ad.au3> #include <array.au3> _AD_Open() $arUsers = _AD_GetObjectsInOU("", "(&(objectclass=user)(name=*))", 2) ;, "sAMAccountName", "sAMAccountName") _ArrayDisplay($arUsers) _AD_Close();-))Stefan@Edit: My glasbowl shows me, that you are using AD.au3 Version 0.37. It works for me, because i'm still using 0.35.There is a bug (just performed a search over forum). Please change in AD.au3 as follow:1.In the new version AD 0.37 the Func _AD_GetObjectsInOU returns an empty array because of $aAD_DataToRetrieve.Original:Line 1133: $aAD_Objects[$iCount2] = $oAD_RecordSet.Fields($aAD_DataToRetrieve).ValueFixed (like previous versions):Line 1133: $aAD_Objects[$iCount2] = $oAD_RecordSet.Fields($sAD_DataToRetrieve).Value -> Hardly to see: The change is from $aAD to $sAD Edited March 23, 2010 by 99ojo Link to comment Share on other sites More sharing options...
darkleton Posted March 23, 2010 Author Share Posted March 23, 2010 thank you (again!) I'm sure it displaying computers too is something i've missed out, but thank you Link to comment Share on other sites More sharing options...
water Posted March 28, 2010 Share Posted March 28, 2010 (edited) Back from vacation so I now start to reply again To get a list of all users from all OUs you have to add the objectcategory. So please try something like:$aObjects = _AD_GetObjectsInOU("", "(&(objectcategory=person)(objectclass=user))", 2, "sAMAccountName") I've extended the examples in the _AD_GetObjectsInOU.au3 so please have a look there as well. I will investigate the error and hope to release a new version quite soon. Edited March 28, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
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