Filip Kasaj

Reconciled action with the stream of life.

User Tools

Site Tools


technet:exchange:csvdatabyte

This is an old revision of the document!


Get CSVData programmatically for New-MigrationBatch

  1. <#
  2. Exchange On-Prem, Exchange Online
  3. Define mailboxes for migration batch programatically without CSV file
  4. $MigUsers = ConvertTo-CSVDataByte "user1@abc.cz","user2@abc.cz"
  5. New-MigrationBatch -Local -Name LocalMove1 -CSVData $MigUsers -TargetDatabases MBXDB2
  6. #>
  7.  
  8. function ConvertTo-CSVDataByte {
  9. Param(
  10. [Parameter(Mandatory = $true)]
  11. [ValidateNotNull()]
  12. [String[]]$Emails
  13. )
  14. $CSVData = [system.Text.Encoding]::Default.GetBytes('"EmailAddress"')
  15. $CSVData += [system.Text.Encoding]::Default.GetBytes("`n")
  16. for ($i = 0; $i -le $Emails.Length - 1; $i++) {
  17. $CSVData += [system.Text.Encoding]::Default.GetBytes('"' + $Emails[$i] + '"')
  18. if ($UPNs.Length - 1 -ne $i) {
  19. $CSVData += [system.Text.Encoding]::Default.GetBytes("`n")
  20. }
  21. }
  22. return $CSVData
  23. }
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
technet/exchange/csvdatabyte.1686728605.txt.gz · Last modified: 2023/06/14 09:43 by A User Not Logged in