Public/Invoke-SyncAAD.ps1

function Invoke-SyncAAD {
    <#
    .SYNOPSIS
        Invoke a delta synchronization between on-premise Active Directory and Azure Active Directory.
    .PARAMETER PolicyType
        Initial or delta
    .EXAMPLE
        !sync
    #>

    [PoshBot.BotCommand(
        CommandName = 'syncaad',
        Aliases = ('sync', 'aad', 'sync-aad')
    )]
    [cmdletbinding()]
    param(
        [parameter()]
        [string]$policytype = "Delta"
    )
    try {
        $result = Invoke-Command -ComputerName "sun-aad.sunssc.local" -ScriptBlock {
            Start-ADSyncSyncCycle -PolicyType $Using:policytype
        }
        New-PoshBotCardResponse -Text ($result | Out-String)
    }
    catch {
        Write-Output "$($_.Exception.Message)"
        Write-Output "$($_.error.message)"
    }
}