***EDITED FOR CLARITY:
My ADP CSV contains these headers exactly as listed: Action Date, Job Information Effective Date,Location Name, Legal Name, Employee Status Code, First Name, Last Name, Employee ID, Job Title, Location State, Location City, Employee Class, Hire Date, Job Termination Date, FLSA Over-Time Indicator, FLSA Status.
My Office 365 CSV contains these headers exactly as listed: DISPLAY NAME, EMAIL ADDRESS
I need a CSV that lists: Display Name, Email Address, City, State, Location Name, Job Title.
I need a Powershell Script that combines the two files together to leave me with only the Office 365 Users and the data that their profile is missing such as City, State, Location Name, Job Title.
I understand creating the Hash Table for the Office 365 List, but every time I create one it returns "The array index evaluated to Null" which in my understanding means I am not using the correct header names in the hash table.
****Edited AGAIN! I am attaching my code. It does everything I need it to except that the Email column it creates is blank. I no longer get hast table errors.
$ItemsToKeep = 'First Name','Last Name','Employee Status Code','Location Name','Job Title','Location State'
$ItemsToKeep += @{Name = "Display Name"; Expression = {$_.'First Name' + ' ' + $_.'Last Name'}}
$ItemsToKeep += @{Name = "Email"; Expression = { $EmailLookupTable[$_.'Display Name'] }}
$EmailLookupTable = @{}
Import-Csv C:\O365LIST.csv |ForEach-Object {
$EmailLookupTable[$_.'Display Name'] = $_.'Email Address'
}
Import-Csv C:\ADPLIST.csv |Where-Object {$_.'Employee Status Code' -eq 'Active'} | Select $ItemsToKeep | export-csv C:\Testing.csv -notypeinformation