Get-Mailbox.Psm1

Function Get-mailbox()
{
$cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $Session
Get-Mailbox|select Name,Alias,Database
}
 
Function Get-UnifiedGroups
{
 <#
    .SYNOPSIS
    Get unified groups.
 
    .DESCRIPTION
    Using this script you get the all unified group
 
    .EXAMPLE
    Get-UnifiedGroups
 
    Get all Unified group.
 
    .EXAMPLE
    Get-UnifiedGroups -GroupName Groupname
 
    Get Unified group with name.
    #>
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true)]
        [string]
        # The name of the Unified Group.
        $GroupName
    )
$cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $Session
$Gpname = $GroupName
Get-UnifiedGroup -Identity $Groupname |select Name,Alias,AccessType
}