I'm currently running a script that obtains a list of Exchange Online mailboxes from a CSV file, and converts them to Shared Mailboxes. I then have the script waiting for a period of time, before looping through the CSV again and extracting the type of Mailbox it is. It's a check to confirm that the mailbox has actually converted successfully. Finally, I want it to add a new column to the CSV file with the mailbox type.
Currently, it all seems to work correctly, except writing back to the CSV. The CSV ends up blank.
$SMTP = import-csv -Path .\Convert.csv | & {
process {
Set-Mailbox -Identity $_.FullAddress -Type Shared -MessageCopyForSentAsEnabled $True -MessageCopyForSendOnBehalfEnabled $True -ErrorAction Continue -WarningAction Continue
}
}
Start-Sleep -Seconds 15
$SMTP = import-csv -Path .\Convert.csv | & {
process {
$MBType = Get-EXOMailbox -Identity $_.FullAddress | Select RecipientTypeDetails
Select-Object *,@{Name='Type';Expression={$MBType}} |
Export-CSV -Path .\Convert.csv -NoTypeInformation
}
}
Initially I thought it's because it can't write to a file that is open, but when exporting to a new CSV, the result is still a blank file.
Thanks in advance for any assistance.