Hi Everyone,
I'm using the following code:
Import-module ActiveDirectory $USERS = Import-Csv C:\temp\R12_Active_Users.csv $USERS|foreach {Get-ADUser -Identity $_.samaccountname -properties * | FT -autosize samaccountname, Name, UserPrincipalName, mail, objectguid, distinguishedname, description, PhysicalDeliveryOfficeName, EmployeeID, EmployeeNumber}
I'm not out'ing this to a text file or exporting to a CSV yet, as the format is not what I am expecting.
Instead of having a table with the headings for each value, followed by the values for all the samaccountnames listed in the CSV that is being imported, I am getting a new heading for all values for each samaccountname.
Is someone able to advise me on where I'm going wrong? I am getting the information that I require, I'm just not getting the table set correctly.
Below is an example of the output:
samaccountname UserPrincipalName mail
------------------- ---------------------- ---------
user1 user1@domain.com user1@domain.com
samaccountname UserPrincipalName mail
------------------- ---------------------- ---------
user2 user2@domain.com user2@domain.com
samaccountname UserPrincipalName mail
------------------- ---------------------- ---------
user3 user3@domain.com user3@domain.com
Output should look like this:
samaccountname UserPrincipalName mail
------------------- ---------------------- ---------
user1 user1@domain.com user1@domain.com
user2 user2@domain.com user2@domain.com
user3 user3@domain.com user3@domain.com
user4 user4@domain.com user4@domain.com
Any assistance on this would be greatly appreciated.
Cheers,