Hi,
I have two csv files generated from a previous script which contain the following:
File1:
#TYPE Selected.Microsoft.Exchange.Management.MapiTasks.Presentation.MailboxStatistics
"DisplayName","TotalItemSize(MB)"
"Person1","25"
"Person2","84"
....(and so on for 10 people)
File2:
#TYPE Selected.Microsoft.Exchange.Management.MapiTasks.Presentation.MailboxStatistics
"DisplayName","TotalItemSize(MB)"
"Person1","45"
"Person2","90"
...(and so on for 10 people)
I'm looking to write a script which performs the following:
- Check the value of the 1st persons TotalItemSize from the 2nd file and subtract it from the same persons value contained within the 1st file, thus receiving either the increase or decrease in value figure.
- After that do the same for the next person, and again until end of display names is reached.
- Finally write all the difference figures to a 3rd csv file along with their respective displaynames.
- Although the display names are stored alphabetically, occasionally, there will be a difference in display names as 1 or more names might have been added to file 2, or removed from file 2. Therefore there has to be a check if this is the case and know to move on to the next name that is in both files to do the calculation.
It is important to note that it does not have to be csv files, I just chose that as it seems easiest to interact with when it comes to creating a spreadsheet from the 3rd file, as it is ideally going to be a data source.
Hope this is in the right area and I've gave enough information. I've been trying to figure out the best way to approach this but being new to powershell, I'm looking for some help. I considered reading in both files and assigning them to a variable, and then subsequently adding each row as 1 element of a hashtable. But when it comes to the actual comparison and the amount of conditional statements needed etc I'm just getting a little mixed up and wondering if this is the most efficient way to do this.
Any help would be appreciated,
Cheers!.