Created
May 23, 2013 19:02
-
-
Save jeffgeiger/5638559 to your computer and use it in GitHub Desktop.
Dump AD user attributes into a SQLite database.
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 | |
Import-Module SQLite #SQLite Module from http://psqlite.codeplex.com/ | |
mount-sqlite -name db -dataSource H:\Papa\bp3_aix.sqlite | |
Get-ADUser -Filter { employeeID -like "*" } -Properties uid, employeeID, sAMAccountName, sn, givenName, Name | foreach { | |
$query = 'insert into ad_dump (uid, empID, sam, sn, gn, name) values ("'+$_.uid+'", "'+$_.employeeID+'", "'+$_.sAMAccountName+'", "'+$_.sn+'", "'+$_.givenName+'", "'+$_.Name+'");' | |
Invoke-Item db: -sql $query | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment