I've been working with the following code for awhile, and it works but it takes hours to run. If I run separate Get- commands I get the results within minutes but as soon as I add the array in it scales up to hours.
I might be biting off more than I can chew with this as I'm still fairly new to PS as I don't need to use it often.
Import-Module Activedirectory
$Data=@(
Get-ADUser -filter * -Properties * |
Select-Object @{Label = "First Name";Expression = {$_.GivenName}},
@{Name = "Last Name";Expression = {$_.Surname}},
@{name= "OU";expression={$_.DistinguishedName.split(',')[1].split('=')[1]}},
@{Name = "Email";Expression = {$_.Mail}},
@{Name = "Account Status";Expression = {if (($_.Enabled -eq 'TRUE') ) {'Enabled'} Else {'Disabled'}}},
@{Name = "Department";Expression = {$_.Department}}
)
$Data | Export-Csv -Path c:\adusers.csv -NoTypeInformation