Public/Migration/MailboxMove/PostMigrationTask/Set-MailboxMoveConvertToShared.ps1

function Set-MailboxMoveConvertToShared {
    <#
    .SYNOPSIS
    Sets Office 365 Mailbox to Shared post migration
    Either CSV or Excel file from SharePoint can be used
 
    .DESCRIPTION
    Sets Office 365 Mailbox to Shared post migration
    Either CSV or Excel file from SharePoint can be used
 
    .PARAMETER SharePointURL
    Sharepoint url ex. https://fabrikam.sharepoint.com/sites/Contoso
 
    .PARAMETER ExcelFile
    Excel file found in "Shared Documents" of SharePoint site specified in SharePointURL
    ex. "Batches.xlsx"
    Minimum headers required are: BatchName, UserPrincipalName
 
    .PARAMETER MailboxCSV
    Path to csv of mailboxes. Minimum headers required are: BatchName, UserPrincipalName
 
    .EXAMPLE
    Set-MailboxMoveConvertToShared -MailboxCSV c:\scripts\batches.csv
 
    .EXAMPLE
    Set-MailboxMoveConvertToShared -SharePointURL 'https://fabrikam.sharepoint.com/sites/Contoso' -ExcelFile 'Batches.xlsx'
 
    .NOTES
    General notes
    #>


    [CmdletBinding(DefaultParameterSetName = 'SharePoint')]
    param (
        [Parameter(Mandatory, ParameterSetName = 'SharePoint')]
        [ValidateNotNullOrEmpty()]
        [string]
        $SharePointURL,

        [Parameter(Mandatory, ParameterSetName = 'SharePoint')]
        [ValidateNotNullOrEmpty()]
        [string]
        $ExcelFile,

        [Parameter(Mandatory, ParameterSetName = 'CSV')]
        [ValidateNotNullOrEmpty()]
        [string]
        $MailboxCSV
    )
    end {
        switch ($PSCmdlet.ParameterSetName) {
            'SharePoint' {
                $SharePointSplat = @{
                    SharePointURL = $SharePointURL
                    ExcelFile     = $ExcelFile
                }
                Invoke-SetMailboxMoveConvertToShared @SharePointSplat | Out-GridView -Title "Results of Set Mailbox to Shared"
            }
            'CSV' {
                $CSVSplat = @{
                    MailboxCSV = $MailboxCSV
                }
                Invoke-SetMailboxMoveConvertToShared @CSVSplat | Out-GridView -Title "Results of Set Mailbox to Shared"
            }
        }
    }
}