Powershell AD – gesperrte Benutzer in csv exportieren

Export locked User Accounts

Search-ADAccount –LockedOut

Import-Module ActiveDirectory
Search-ADAccount –LockedOut |
Select -Property Name,DistinguishedName

Import-Module ActiveDirectory
Search-ADAccount  -SearchBase “OU=TestOU,DC=NDSEDV,DC=de” –LockedOut |
Select -Property Name,DistinguishedName

Import-Module ActiveDirectory
Search-ADAccount –LockedOut |
Select -Property Name,DistinguishedName |
Export-CSV “C:\\Temp\\GesperrteADUser.csv” -NoTypeInformation -Encoding UTF8