I would like the following script to include the variables on the second script and it "i" variable I would like to show as Location
Get-ADUser -Filter * -Properties title, department, manager | Select-Object title,department,@{name='ManagerName';expression={(Get-ADUser -Identity $_.manager | Select-Object -ExpandProperty name)}},@{name='ManagerEmailAddress';expression={(Get-ADUser -Identity $_.manager -Properties emailaddress | Select-Object -ExpandProperty emailaddress)}} | Format-list
Get-ADUser -Filter * -Properties Name, mail,title, canonicalName, department, l, Manager, mobile,telephoneNumber | where {$_.Enabled -eq "True"} | Select-Object Name,mail,title,canonicalName,department,l,Manager,mobile,telephoneNumber | Export-CSV adusersactive.csv
The aim here is to export as clear list of users from AD which includes Name, email, job title, OU, department, location , Manager, mobile, and telephone number and formats it to a CSV , if there is a better way of doing this please let me know.