Created
November 8, 2016 21:08
-
-
Save rueedlinger/63c605e69a76e6e75e7c0d300b8a4321 to your computer and use it in GitHub Desktop.
Extract data from active directory (PowerShell)
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
Import-Module ActiveDirectory | |
$ADSearchBase = "OU=Employees,OU=Users,OU=XYZ,DC=ads,DC=XYZ,DC=com" | |
$OutFile = "C:\tmp\ad_export.csv" | |
Get-ADUser -filter * -properties GivenName,Surname,CN,Title,Department,Country,City,EmailAddress,whenCreated -SearchBase $ADSearchBase | select GivenName,Surname,CN,Title,Department,Country,City,EmailAddress,whenCreated | Export-Csv $OutFile -NoTypeInformation -Encoding "UTF8" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment