top of page

PowerShell - Get ALL Users Last Login on Domain

  • Writer: Jon Boyette
    Jon Boyette
  • Jan 10, 2022
  • 1 min read

Save as .ps1, Gets ALL Domain users last Domain login, and reports to c:\temp\alluserslastlogin.csv


$(foreach ($DC in ((get-addomaincontroller -filter * | sort name).name) ){ $user = get-aduser -Filter {name -like "*"} -properties lastlogon -server $dc | select name,lastlogon ; echo "$DC - $(w32tm /ntte $user.lastlogon)" } )| export-csv "c:\temp\alluserslastlogin.csv" -notypeinformation



 
 
 

Recent Posts

See All
PowerShell - List All Domain SPNs

Save as same List_ALL_SPNs.ps1 or similar, this LDap calls the Domain for all Service Principal names and accounts related #Build LDAP...

 
 
 
PowerShell - Start-Monitoring

This is a great script used to Monitor and Email if a server is up or down, once ran, and smtp and from address is set, then run:...

 
 
 

Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Boyette Technical Services. Proudly created with Wix.com

bottom of page