PowerShell - Users OU inventory
- Jon Boyette
- Apr 15, 2022
- 1 min read
Save as a named .ps1, add your OU to parse users from, and the ExportPath
$OUpath = 'ou=users,dc=domain,dc=com'
$ExportPath = 'c:\temp\ADUsers_Inventory.csv'
Get-ADUser -Filter * -SearchBase $OUpath | Select-object DistinguishedName,Name,UserPrincipalName,SamAccountName | Export-Csv -NoType $ExportPath
Comments