Jump to content

FQDN from computername (only)


rikho
 Share

Recommended Posts

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

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 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 - 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 (NEW 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

 

Link to comment
Share on other sites

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 by rikho
Link to comment
Share on other sites

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 - 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 (NEW 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

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...