carloselectro Posted May 25, 2017 Share Posted May 25, 2017 Hi, I'm trying to get the computer 's OS version from the Active Directory with the AD UDF but I cannot get it to work. The following code work so I know my syntax is alright: $aResult = _AD_GetObjectAttribute("my_pc_name$", "name") ConsoleWrite("My attribute:" & $aResult) But I cannot get the OS version attribute even though it does exist in the AD: $aResult = _AD_GetObjectAttribute("my_pc_name$", "operatingSystem") ConsoleWrite("My attribute:" & $aResult) I get the following errors: Local $sResult = $oObject.Get($sAttribute) Local $sResult = $oObject^ ERROR Am I supposed to be able to get any existing attribute from the AD? Link to comment Share on other sites More sharing options...
benched42 Posted May 25, 2017 Share Posted May 25, 2017 According to Microsoft, the attribute "operatingSystem" only exists on Windows Server builds starting with Windows 2000 Server. https://msdn.microsoft.com/en-us/library/ms679076(v=vs.85).aspx Who lied and told you life would EVER be fair? Link to comment Share on other sites More sharing options...
anthonyjr2 Posted May 25, 2017 Share Posted May 25, 2017 (edited) I would hope he is running a Windows Server build more recent than Windows 2000 anyway . Edited May 25, 2017 by anthonyjr2 UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
Subz Posted May 25, 2017 Share Posted May 25, 2017 The following works fine for me Windows 10 Enterprise x64, AD UDF Version 1.4.7.0 #include <AD.au3> _AD_Open() $aResult = _AD_GetObjectAttribute(@ComputerName & "$", "operatingSystem") _AD_Close() ConsoleWrite("My attribute for " & @ComputerName & ":" & $aResult & @CRLF) Link to comment Share on other sites More sharing options...
carloselectro Posted May 25, 2017 Author Share Posted May 25, 2017 I am using Server 2012. My UDF version is 1.4.8.0. I wonder why it works for you. Link to comment Share on other sites More sharing options...
Subz Posted May 25, 2017 Share Posted May 25, 2017 Not sure our servers are a mix of Win 2008 R2, Win 2012 R2 and Win 2016, looking at the error it looks as though its lost the connection to AD, even if I add an unknown computer name it doesn't throw any errors, normally I would then use the @error to find out the issue. Looking at the _AD_GetObjectAttribute function (Ctrl+J) it must be failing here: Local $oObject = __AD_ObjGet($sLDAPEntry) ; Retrieve the COM Object for the object Link to comment Share on other sites More sharing options...
water Posted May 26, 2017 Share Posted May 26, 2017 Can you please post the full error message? Can you please post the complete script you run? 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...
carloselectro Posted May 26, 2017 Author Share Posted May 26, 2017 My problem seems to be related to the way I call the _AD_Open function: This works $iResult = _AD_Open() This does not: $iResult = _AD_Open("", "", "", "dti-dc3:3268") ; LDAP Catalog INfo Link to comment Share on other sites More sharing options...
water Posted May 26, 2017 Share Posted May 26, 2017 What is the value of @error after _AD_Open? 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...
carloselectro Posted May 26, 2017 Author Share Posted May 26, 2017 There's no error after executing _AD_Open , it return 0 in both cases. Link to comment Share on other sites More sharing options...
water Posted May 26, 2017 Share Posted May 26, 2017 Can you please pass the full name as parameter 4? Means "dti-dc3.company.com:3268" (example) instead of "dti-dc3:3268". 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...
carloselectro Posted May 26, 2017 Author Share Posted May 26, 2017 I just did and I get the same error: Error:0"D:\PortableApps\Autoit Portable\Include_Custom\AD\AD.au3" (641) : ==> The requested action with this object has failed.: Local $sResult = $oObject.Get($sAttribute) Local $sResult = $oObject^ ERROR Link to comment Share on other sites More sharing options...
water Posted May 26, 2017 Share Posted May 26, 2017 Which version of AutoIt do you run? 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...
carloselectro Posted May 26, 2017 Author Share Posted May 26, 2017 Version 3.3.14.2 Link to comment Share on other sites More sharing options...
water Posted May 26, 2017 Share Posted May 26, 2017 Will check as soon as I return to my office. 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...
carloselectro Posted May 26, 2017 Author Share Posted May 26, 2017 Sure, I can make it work for now by using _AD_OPEN() only but I'll be available to do do more testing. Link to comment Share on other sites More sharing options...
water Posted May 29, 2017 Share Posted May 29, 2017 The problem you face is caused by the fact that not all properties are propagated to the Global Catalog. Here you find a list of all available properties: http://www.selfadsi.org/global-catalog-attributes.htm 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...
carloselectro Posted May 29, 2017 Author Share Posted May 29, 2017 Thank you for the followup. Link to comment Share on other sites More sharing options...
water Posted May 29, 2017 Share Posted May 29, 2017 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