Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Get-ADUser -SearchBase "ou=ouname,ou=ouname,dc=domainname,dc=suffix" -Filter * | Select-Object -Property Name | Sort-Object{Get-Random} | select -First 10
- $timeFrame = (get-Date).AddDays(-90)
- get-aduser -SearchBase 'ou=ouname,ou=ouname,dc=domainname,dc=suffix' -Filter * -Properties * |
- Where-Object {$_.whenChanged -gt $timeFrame -and $_.mail -ne $null} |
- Select-Object -Property Name | Sort-Object{Get-Random} | select -First 10
- # LastLogontimeStamp is not guaranteed to be updated on every login, so 30 days + 14 days margin
- $threshold = (Get-Date).AddDays(-44).ToFileTime()
- Get-ADUser -Filter {Enabled -eq $true -and LastLogontimeStamp -gt $threshold} -SearchBase "ou=ouname,ou=ouname,dc=domainname,dc=suffix" | Sort-Object {Get-Random} | Select Name -First 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement