sample.ps1

# install PowerShell module if not already present
$module = Get-InstalledModule | ? { $_.Name -like '*BinaryTree.Power365' }
If ($module -eq $null) { Install-Module BinaryTree.Power365 }

# connect to Power365 API using sample API Key
$apiKey = ConvertTo-SecureString 5bd6b4e86700415c9cc27d0ec131ea2727b22426118849f59e859d77e60eb549 -AsPlainText -Force
Write-Host 'Session'
$session = Connect-P365Session -ApiKey $apiKey
$session | FL

# get projects
Write-Host 'Projects'
$projects = Get-P365Project
$projects | FT ProjectId,ProjectType,ProjectName

# find the project called "C29 to C30 Basic"
$project = $projects | ? { $_.ProjectName -eq 'C29 to C30 Basic' }

# get the project's UserMigrations
Write-Host 'UserMigrations'
$userMigrations = Get-P365UserMigration -Project $project
$userMigrations | Select UserMigrationId,MigrationState -ExpandProperty SourceUser | Select UserMigrationId,MigrationState,PrimarySmtpAddress | FT

# get a UserMigration's SyncJobs
$userMigrationId = 186730
Write-Host "SyncJobs"
$syncJobs = Get-P365SyncJob -UserMigration $userMigrationId
$syncJobs | FT SyncJobId,SyncDataType,Started,Completed,PercentComplete

# get the 5 newest rows of a sync job log
$syncJobId = 17412
Write-Host "SyncJobLogs"
$syncJobLogs = Get-P365JobLog -SyncJob $syncJobId -Limit 5
$syncJobLogs | FT