Powershell AD – Inaktive Benutzer in csv exportieren

Export inactive Users

Search-ADAccount –AccountInactive -DateTime “5/28/2016” -UsersOnly

Import-Module ActiveDirectory
Search-ADAccount –AccountInactive -TimeSpan 90.00:00:00 -UsersOnly |
Select -Property Name,DistinguishedName,LastLogonDate

Import-Module ActiveDirectory
Search-ADAccount –AccountInactive -DateTime “1/8/2016” -UsersOnly |
Select -Property Name,DistinguishedName,LastLogonDate

Import-Module ActiveDirectory
Search-ADAccount -SearchBase “OU=TestOU,DC=NDSEDV,DC=de” –AccountInactive -TimeSpan 90.00:00:00 -UsersOnly |
Select -Property Name,DistinguishedName,LastLogonDate

Import-Module ActiveDirectory
Search-ADAccount –AccountInactive -TimeSpan 90.00:00:00 -UsersOnly |
Select -Property Name,DistinguishedName,LastLogonDate |
Export-CSV “C:\\Temp\\InaktiveADUser.csv” -NoTypeInformation -Encoding UTF8