rikho Posted August 18, 2009 Share Posted August 18, 2009 Hi all, I got the solution for a user, but for a computer there is always the same problem. $LastLogonTimeStamp = _ADGetObjectAttribute($username, $attribute) chen i change $username by $computername --> error : Variable must be of type object ! Can u drive me on the solution way Need to get attribute about computer in my AD. please need a master... thx Link to comment Share on other sites More sharing options...
water Posted August 18, 2009 Share Posted August 18, 2009 (edited) To get info for a computer you have to append "{:content:}quot; to the computername to get a valid sAMAccountname:_ADGetObjectAttribute(@ComputerName & "{:content:}quot;,"lastLogon")Unfortunately you have to translate the returned data into a readable form. The lastLogon data (at least for users) is not propagated to all Domain Servers immediately. To get the "real" last logon date you have to ask all Domain Servers and take the most current.I have posted some code to get the "true" logon date and to convert the returned data into readable form. I'm on vacation so please have a look at the forum yourself or - if it is not that urgent - wait till I return.Or have a look at this post. Edited August 18, 2009 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...
rikho Posted August 18, 2009 Author Share Posted August 18, 2009 (edited) To get info for a computer you have to append "{:content:}quot; to the computername to get a valid sAMAccountname: _ADGetObjectAttribute(@ComputerName & "{:content:}quot;,"lastLogon") Unfortunately you have to translate the returned data into a readable form. The lastLogon data (at least for users) is not propagated to all Domain Servers immediately. To get the "real" last logon date you have to ask all Domain Servers and take the most current. I have posted some code to get the "true" logon date and to convert the returned data into readable form. I'm on vacation so please have a look at the forum yourself or - if it is not that urgent - wait till I return. Or have a look at this post. Thank you ! very much. I hope your vacation are great and i am going to have a look at your post. It will not be difficult to compare each date about all DC i did it in another life for users. The main difficulty for me is to call _ADGetObjectAttribute(@ComputerName & "{:content:}quot;,"lastLogon") Login_computer.au3 (12) : ==> Unterminated string.: $LastLogonTimeStamp = _ADGetObjectAttribute(@ComputerName & "{:content:}quot;"lastLogon") i think the syntax have a problem but i cant fix it >_< Do i have to change some value ? (i got the same error com message) is "{:content:} = FQDN ? or the path in AD ? I run it from a DC and will check all domain computers (then i want to delete all computer with a 6 months old lastlogon) Regards. Edited August 18, 2009 by rikho Link to comment Share on other sites More sharing options...
rikho Posted August 19, 2009 Author Share Posted August 19, 2009 What do you mean about "{:content:}quot; i got a syntax error while using it >_< Link to comment Share on other sites More sharing options...
water Posted August 19, 2009 Share Posted August 19, 2009 Seems to be a problem with the forum software. It should read: _ADGetObjectAttribute(@ComputerName & "$","lastLogon") 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