Get AD User where closed between tow dates
1 2 3 4 5 6 7 |
$filter = "(useraccountcontrol:1.2.840.113556.1.4.803:=2)" $start = Get-Date "1/1/2020" $end = Get-Date "31/12/2020" Get-ADUser -LDAPFilter $filter -Properties "*" | ? { $_.modifyTimeStamp -gt $start -and $_.modifyTimeStamp -lt $end } | Select-Object Name, whenChanged | export-csv c:\PS\$1.csv |
Get User Pasword Never Expierd
1 2 3 4 5 6 7 8 9 |
# Import the AD module to the session Import-Module ActiveDirectory #Search for the users and export report get-aduser -filter * -properties Name, PasswordNeverExpires | where { $_.passwordNeverExpires -eq "true" } | Select-Object DistinguishedName,Name,Enabled | Export-csv c:\scripts\pw_never_expires.csv -NoTypeInformation |