Sid_F
asked on
Export list of disabled users AD
Can any one tell me the exact command to export disabled users to a file using csvde thanks.
ASKER
I need to do it via csvde
You can try using -r to specify the enabled=yes.
https://technet.microsoft.com/en-us/library/cc757853(v=ws.10).aspx
Let's start from the begining, what is it you want to achieve at the end? Do you have the option to delete disabled accounts?
Look at the ldap filter list from http://social.technet.microsoft.com/wiki/contents/articles/5392.active-directory-ldap-syntax-filters.aspx they have a reference on how to identify disabled accounts, you need to change the filter to exclude them.
Search for all disabled user accounts or something like that, three four pages down.
https://technet.microsoft.com/en-us/library/cc757853(v=ws.10).aspx
Let's start from the begining, what is it you want to achieve at the end? Do you have the option to delete disabled accounts?
Look at the ldap filter list from http://social.technet.microsoft.com/wiki/contents/articles/5392.active-directory-ldap-syntax-filters.aspx they have a reference on how to identify disabled accounts, you need to change the filter to exclude them.
Search for all disabled user accounts or something like that, three four pages down.
ASKER
Ok found out the detail from http://www.computerperformance.co.uk/Logon/Logon_CSVDE_switches.htm
csvde -f c:\AllDisabled.csv -r "(|(useraccountcontrol=514 )(useracco untcontrol =546)(user accountcon trol=66050 ))" -l "DN, objectclass, objectcategory, sn, givenName, sAMAccountName, useraccountcontrol"
This will output all disabled users in AD
csvde -f c:\AllDisabled.csv -r "(|(useraccountcontrol=514
This will output all disabled users in AD
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Import-Module ActiveDirectory
Get-ADUser -Filter {Enabled -eq $false}
To export it to a CSV file you would use the Export-CSV command in Powershell, e.g.
Get-ADUser -Filter {Enabled -eq $false} | Export-Csv "C:\some\folder\somefile.c