Get computer last logon date PowerShell
In this post, I describe how to get the last logon date for computers in Active Directory using PowerShell.
Get last logon date for a single computer
To retrieve the last logon date for a single computer, specified by name, use the following PowerShell cmdlet:
Get-ADComputer -Identity %COMPUTERNAME% -Properties LastLogonDate | FT Name, LastLogonDate
Get-ADComputer -Identity %COMPUTERNAME% -Properties LastLogonDate | FT Name, LastLogonDate
Get last logon date for all computers
To retrieve the last logon date for all computers in a domain, use the following PowerShell cmdlet:
Get-ADComputer -Filter * -Properties LastLogonDate | FT Name, LastLogonDate
Get-ADComputer -Filter * -Properties LastLogonDate | FT Name, LastLogonDate
Comments
Post a Comment