Get-Mailbox.Psm1

Function Get-MailboxLastLogonTime()
{
<#
    .SYNOPSIS
    Get Mailbox last logon Time.
 
    .DESCRIPTION
    Using this script you will get the Mailbox last logon Time
 
    .EXAMPLE
    Get-MailboxLastLogonTime -MailboxName uasername
 
    Get all Mailbox Last LogonTime .
 
     
    #>
     [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true)]
        [string]
        # The name of the Mailbox.
        $MailboxName
    )
$cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $Session
$MbName = $MailboxName
 
Get-MailboxStatistics -Identity $MbName -ErrorAction ignore |select DisplayName,LastLogonTime
 
}
 
Function Get-UnifiedGroups
{
 <#
    .SYNOPSIS
    Get unified groups.
 
    .DESCRIPTION
    Using this script you get the unified group details
 
    .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
}