Skip to content

Instantly share code, notes, and snippets.

@jeffgeiger
Created May 23, 2013 19:02
Show Gist options
  • Save jeffgeiger/5638559 to your computer and use it in GitHub Desktop.
Save jeffgeiger/5638559 to your computer and use it in GitHub Desktop.
Dump AD user attributes into a SQLite database.
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