helpers/Connect-O365Compliance.ps1
function Connect-O365Compliance { PARAM ( [System.Management.Automation.PSCredential] $Credential ) $ComplianceParams = @{ ConfigurationName = 'Microsoft.Exchange' ConnectionUri = "https://$ComplianceComputerName/powershell-liveid/" Credential = $Credential Authentication = 'Basic' AllowRedirection = $true } $CCSession = New-PSSession @ComplianceParams $ModuleName = 'ComplianceCenter' $ModulePath = Join-Path $AppdataPath $ModuleName $null = Export-PSSession -Session $CCSession -OutputModule $ModulePath -AllowClobber -Force Import-Module $ModulePath -Global -DisableNameChecking -Prefix CC } |