Advertisement
Combreal

miscellaneous.ps1

Sep 19th, 2019
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Get all AD computer with Win7 logged the last 6 months :
  2. Get-ADComputer -SearchBase "ou=myOU,dc=ad,dc=myentreprise,dc=fr" -Filter {OperatingSystem -Like '*win*7*' } -Properties OperatingSystem, LastLogonDate | ? { $_.LastLogonDate -GT (Get-Date).AddDays(-180) } | select -Property Name, Lastlogondate, OperatingSystem  | Export-Csv -Path $env:homepath"\win7Machines6Mon.csv"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement