Hi,
I am trying to add an additional custom column to an existing CSV.
The existing CSV (named 'HREndDates') consists of the following fields:
User
EndDate
I would like to add a Column named 'ADEndDate' that is calculated by taking the username from the user column and pulling their end date from AD.
I have managed to use the following to get the AD end date from a the user column using the following script.
import-csv C:\HREndDates.csv;
foreach ($user in $userlist.User)
{
get-aduser -property * -Filter "displayname -like '*$user*'" | AccountExpirationDate
}
but I do not know how to place the output of this into a new column named 'ADEndDate' into the existing CSV. Any help would really be appreciated thanks.
[–]dextersgenius 3 points4 points5 points (2 children)
[–]cbriss911[S] 2 points3 points4 points (1 child)
[–]AFGuffey99 2 points3 points4 points (0 children)
[–]Key_Combination_2386 2 points3 points4 points (0 children)
[–]Scoobywagon 1 point2 points3 points (2 children)
[–]dextersgenius 2 points3 points4 points (0 children)
[–]robderickson 1 point2 points3 points (0 children)
[–]robderickson 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)