Skip to content

Get-ResourceProperties

Exchange Online: Gets resource mailbox properties

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$MailboxId,
    [ValidateSet('*','DisplayName','WindowsEmailAddress','ResourceCapacity','AccountDisabled','IsMailboxEnabled','DistinguishedName','Alias','Guid','SamAccountName')]
    [string[]]$Properties = @('DisplayName','WindowsEmailAddress','ResourceCapacity','AccountDisabled','IsMailboxEnabled','DistinguishedName','Alias','Guid','SamAccountName')
)

Process {
    try {
        [string[]]$calProperties = @('AllBookInPolicy','AllowRecurringMeetings','BookingWindowInDays','EnforceSchedulingHorizon','MaximumDurationInMinutes','ScheduleOnlyDuringWorkHours')
        $res = Get-Mailbox -Identity $MailboxId -ErrorAction Stop | Select-Object $Properties

        if ($null -eq $res) {
            throw "Resource $($MailboxId) not found"
        }

        $calResult = Get-CalendarProcessing -Identity $MailboxId -ErrorAction Stop | Select-Object $calProperties
        $ts = Get-Date -Format "yyyy-MM-dd HH:mm:ss"

        $res | Add-Member -NotePropertyName Timestamp -NotePropertyValue $ts -PassThru -Force
        Write-Output $res
        $calResult | Add-Member -NotePropertyName Timestamp -NotePropertyValue $ts -PassThru -Force
        Write-Output $calResult
    }
    catch { throw }
}

Alias, Display name, Distinguished name, SamAccountName, Guid or user principal name of the resource

List of properties to expand. Use * for all properties

An interactive directory of PowerShell scripts.