Skip to content

Instantly share code, notes, and snippets.

@StephenFerrero
Last active March 11, 2022 00:58
Show Gist options
  • Save StephenFerrero/d8b5623f2c198a5ed9ecacd281d82b94 to your computer and use it in GitHub Desktop.
Save StephenFerrero/d8b5623f2c198a5ed9ecacd281d82b94 to your computer and use it in GitHub Desktop.
Get list of AD Users
Import-Module Active Directory
Get-ADUser -Properties * -LDAPFilter '(name=*)' -SearchBase "OU=Employees,OU=CON - User Accounts,DC=contoso,DC=com" | Select Name , SamAccountName , LastLogonDate | Export-Csv C:\Users.csv 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment