Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
Created June 9, 2016 16:08
Show Gist options
  • Save ciphertxt/043bdaec2754fb4c28d7f47b337a64e9 to your computer and use it in GitHub Desktop.
Save ciphertxt/043bdaec2754fb4c28d7f47b337a64e9 to your computer and use it in GitHub Desktop.
Returns a listing from Active Directory of users without an office location who are enabled.
get-aduser -filter {-not(office -like "*") -and (enabled -eq $true)} -properties * | select userprincipalname, samaccountname, surname, givenname, sid, office | export-csv ~\Downloads\ADUsersWithNoOffice.csv -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment