BeforeAll { #Connecting to Exchange Online PowerShell Module . #Functions function Get-UsageLocation ($User) { return (Get-Mailbox $User).UsageLocation } function Get-HiddenFromGal ($Account) { return (Get-Mailbox $Account).HiddenFromAddressListsEnabled } } Describe "Retrieve Mailbox Information" -Tag 'MailboxInfo' { BeforeEach { Write-Host "BeforeEach Block" -BackgroundColor DarkMagenta } AfterEach { Write-Host "AfterEach Block" -BackgroundColor Black } Context "Check Usage Location" { It "Check if India" -Tag "India" { Get-UsageLocation "yogi@testdomain1988.onmicrosoft.com" | Should -Be "India" } It "Usage location should not be UK" -Tag "NotUK" { Get-UsageLocation "derek@testdomain1988.onmicrosoft.com" | Should -Not -Be "United Kingdom" } } #end of usagelocation context Context "Is it hidden from the address book" -Tag HiddenFromGAL { It "Check hidden from GAL attribute" { Get-HiddenFromGal "vignesh@testdomain1988.onmicrosoft.com" | Should -Be "False" } } #end of Hidden from GAL context block AfterAll{ Disconnect-ExchangeOnline -Confirm:$false } }