by

Displaying the Calendar Configuration of a Mailbox or Assembly Room utilizing EWS

Displaying the Calendar Configuration of a Mailbox or Assembly Room utilizing EWS Once you configure Calendar processing settings in Change both utilizing the Change Administrator Centre by way of the Change Administration Shell (Set-CalendarProcessing) many of those setting get held in a FAI (Folder Related Merchandise) within the Calendar Folder of the Mailbox in query. In EWS you possibly can entry these configuration objects utilizing the UserConfiguration operation and courses.

The Calendar settings are saved in the Roaming Dictionary format to retailer every of the totally different Key and Worth pairs. For a number of the settings just like the bookin coverage (In-policy assembly requests) and (Out-of-policy assembly requests) these are saved as an array of ExchangeDn’s.

I’ve put collectively a script cmdlet referred to as Present-CalendarSettings that may dump out the Roaming dictionary setting for a Calendar Configuration object utilizing EWS. And in addition for the BookIn and RequestIn coverage it is going to loop by means of every of the ExchangeDn’s within the array and attempt to resolve every of the entries by way of ResolveName . All of the configuration data is written to file and the outcomes of the ResolveName is written together with the consequence (eg legitimate if it resolves could not resolve if not). eg it produces an output like

  I’ve put the script on GitHub right here https://github.com/gscales/Powershell-Scripts/blob/grasp/DumpCalSettings.ps1 and the script itself appear like

perform Present-CalendarSettings
{
param(
[Parameter(Place=0, Necessary=$true)] [string]$MailboxName,
[Parameter(Place=1, Necessary=$true)] [System.Management.Automation.PSCredential]$Credentials,
[Parameter(Place=2, Necessary=$false)] [switch]$useImpersonation,
[Parameter(Place=3, Necessary=$false)] [string]$url
)
Start
{
$service = Join-Change -MailboxName $MailboxName -Credentials $Credentials
if($useImpersonation.IsPresent){
$service.ImpersonatedUserId = new-object Microsoft.Change.WebServices.Information.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress, $MailboxName)
}
# Bind to the Calendar Folder
$folderid= new-object Microsoft.Change.WebServices.Information.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar,$MailboxName)
$Calendar = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid)
$UsrConfig = [Microsoft.Exchange.WebServices.Data.UserConfiguration]::Bind($service, "Calendar", $Calendar.Id, [Microsoft.Exchange.WebServices.Data.UserConfigurationProperties]::All)
#$UsrConfig.Dictionary
$rptCollection = @()
foreach($cnfObj in $UsrConfig.Dictionary.Key){
$rptObj = "" | Choose Property,Worth,Legitimate
$rptObj.Property = $cnfObj
$rptObj.Legitimate = "Ok"
$rptObj.Worth = $UsrConfig.Dictionary[$cnfObj]
$rptCollection +=$rptObj
if($cnfObj -eq "BookInPolicyLegDN")
{
foreach($LegDn in $UsrConfig.Dictionary["BookInPolicyLegDN"])
{
$ncCol = $service.ResolveName($LegDn, [Microsoft.Exchange.WebServices.Data.ResolveNameSearchLocation]::DirectoryOnly, $false);
if($ncCol.Depend -gt 0) Choose Property,Worth,Legitimate
$rptObj.Property = "BookInPolicyValue"
$rptObj.Worth = $ncCol[0].Mailbox.Tackle
$rptObj.Legitimate = "Ok"
$rptCollection +=$rptObj

else
Choose Property,Worth,Legitimate
$rptObj.Property = "BookInPolicyValue"
$rptObj.Worth = $LegDn
$rptObj.Legitimate = "Couldn't resolve"
$rptCollection +=$rptObj


}
}
if($cnfObj -eq "RequestInPolicyLegDN")
{
foreach($LegDn in $UsrConfig.Dictionary["RequestInPolicyLegDN"])
{
$ncCol = $service.ResolveName($LegDn, [Microsoft.Exchange.WebServices.Data.ResolveNameSearchLocation]::DirectoryOnly, $false);
if($ncCol.Depend -gt 0) Choose Property,Worth,Legitimate
$rptObj.Property = "RequestInPolicyValue"
$rptObj.Worth = $ncCol[0].Mailbox.Tackle
$rptObj.Legitimate = "Ok"
$rptCollection +=$rptObj

else
Choose Property,Worth,Legitimate
$rptObj.Property = "RequestInPolicyValue"
$rptObj.Worth = $LegDn
$rptObj.Legitimate = "Couldn't resolve"
$rptCollection +=$rptObj


}
}
}
Write-Output $rptCollection

$rptCollection | Export-Csv -Path ("$MailboxName-CalendarSetting.csv") -NoTypeInformation
}
}