Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. $currentDate = Get-Date
  2. $daysAgo = 5
  3. $dateAgo = $currentDate.AddDays(-$daysAgo)
  4.  
  5. "Current Date = " + $currentDate
  6. "Days Ago = " + $daysAgo
  7. "Date Ago = " + $dateAgo
  8.  
  9.  
  10. Get-ADUser -Filter * -Properties LastLogonDate | Select Name, LastLogonDate | where { $_.LastLogonDate -lt $dateAgo}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement