Support
 
Phone Get Quote
 
Support
 
US: +1 888 720 9500
US: +1 888 791 1189
Intl: +1 925 924 9500
Aus: +1 800 631 268
UK: 0800 028 6590
CN: +86 400 660 8680

Direct Inward Dialing: +1 408 916 9892

How to find remote desktop users' logon time

Here is a comparison between getting user logon times from remote desktop computers via Windows PowerShell and ADAudit Plus.

Using Windows PowerShell

  • Identify the domain from which you need the logon information.
  • Identify the attributes that you want listed.
  • Determine the remote computer from which you need to collect the logs. You need the IP address, NETBIOS name or the FQDN of the remote computer.
  • Compile the script.
  • Execute it in Windows PowerShell
  • The report will be exported in the given format.
  • To obtain the report in a different format, modify the script accordingly.

Here is a sample script:

$colEvents = Get-WinEvent -ComputerName $ComputerName -LogName "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" |  
Where {$_.ID -eq "21"} |  
Select -Property TimeCreated, Message 
Write-Host "Login Time,Username" 
Foreach ($Event in $colEvents) 
{ 
  $EventTimeCreated = $Event.TimeCreated 
  $EventMessage = $Event.Message -split "`n" | Select-Object -Index "2" 
  $EventMessageUser = $EventMessage.Substring(6) 
  Write-Host "$EventTimeCreated,$EventMessageUser" 
} 
Export-CSV “C:\Temp\RemoteUserLogonTime.CSV” -NoTypeInformation
 Copied
Click to copy entire script

Using ADAudit Plus

  • Select Remote Desktop Services Activity from Reports>Local Logon-Logoff
  • Select the Domain and OU and then click generate.
  • You can export the report in the various formats listed (CSV, PDF, HTML, CSVDE and XLSX).

Screenshot

Powershell-get-remote-desktop-login-1
 

The following are the limitations of using Windows PowerShell to generate a list of remote user login time:

  • We can run this script only from the computers which has Active Directory Domain Services role.
  • The script has to be modified if you wish to change the date formats.
  • Parts of the script will have to be changed if you wish to export the script in a different format.
  • Applying more filters would add to the complexity of the script.

ADAudit Plus will swiftly generate reports by scanning all the DCs and these reports can be exported in multiple formats.

  • Avoid complex PowerShell-scripting, and simplify AD change auditing with ADAudit Plus.
  •  
  • By clicking 'Get Your Free Trial', you agree to processing of personal data according to the Privacy Policy.
  •  
  • Thanks!
  • Your download is in progress and it will be completed in just a few seconds! If you face any issues, download manually here.

Related Resources

ADAudit Plus Trusted By