Created
December 7, 2018 12:04
-
-
Save mczerniawski/fd15c15d27fc2541da012df53ddf8598 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$userOUs = @('OU=Leavers,OU=Site1,OU=Contoso Users,DC=Contoso,DC=com','OU=Leavers,OU=Site2,OU=Contoso Users,DC=Contoso,DC=com') | |
$disabledUsers = foreach ($ou in $userOUs) { | |
get-aduser -filter {Enabled -eq $false} -SearchBase $ou | |
} | |
$disabledUsers | Export-Csv -Path C:\AdminTools\disabled_users.csv -NoTypeInformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment