Associate
OK so basically what i want to do is create a csv file with the diplayname, server, Alias and size of a set of users from a csv file
$ukstats = Import-Csv "D:\PS_scripts\data_files\Alpha\teststats-uk.csv"
$ukstats | foreach {
Get-MailboxStatistics -identity $_.name | select displayname, servername, Alias, totalitemsize | Export-Csv D:\PS_scripts\data_files\Alpha\mailboxresultsuk.csv
}
This is what I have above, the problem I have is that it creates the export but only has the last user from the import file. Why is it not doing it for each user in turn? I don't really do the powershell side of things that's my colleague but he's on holiday for two weeks and as is always the case management want this info asap.
$ukstats = Import-Csv "D:\PS_scripts\data_files\Alpha\teststats-uk.csv"
$ukstats | foreach {
Get-MailboxStatistics -identity $_.name | select displayname, servername, Alias, totalitemsize | Export-Csv D:\PS_scripts\data_files\Alpha\mailboxresultsuk.csv
}
This is what I have above, the problem I have is that it creates the export but only has the last user from the import file. Why is it not doing it for each user in turn? I don't really do the powershell side of things that's my colleague but he's on holiday for two weeks and as is always the case management want this info asap.