Functions/Get-ExchangeOnlineSettingObjects.ps1
<#
.SYNOPSIS This function returns objects representing the various settings which can be retrieved from Exchange Online. .DESCRIPTION This function returns objects representing the various settings which can be retrieved from Exchange Online. Each object contains a description of the setting, a script block which returns the value of the setting, and the name of the setting which is suitable for a variable name. #> function Get-ExchangeOnlineSettingObjects { [CmdletBinding(PositionalBinding=$false)] [OutputType([PSCustomObject[]])] param () # Return the setting objects return @( [PSCustomObject]@{ Description = "ATP policies" ScriptBlock = { Get-ATPPolicyForO365 | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "ATPPolicies" }, [PSCustomObject]@{ Description = "phish filter policies" ScriptBlock = { Get-PhishFilterPolicy -Detailed -SpoofAllowBlockList | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "PhishFilterPolicies" }, [PSCustomObject]@{ Description = "safe attachment policies" ScriptBlock = { Get-SafeAttachmentPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "SafeAttachmentPolicies" }, [PSCustomObject]@{ Description = "safe attachment rules" ScriptBlock = { Get-SafeAttachmentRule | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "SafeAttachmentRules" }, [PSCustomObject]@{ Description = "safe links rules" ScriptBlock = { Get-SafeLinksRule | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "SafeLinksRules" }, [PSCustomObject]@{ Description = "malware filter policies" ScriptBlock = { Get-MalwareFilterPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "MalwareFilterPolicies" }, [PSCustomObject]@{ Description = "hosted connection filter policies" ScriptBlock = { Get-HostedConnectionFilterPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "HostedConnectionFilterPolicies" }, [PSCustomObject]@{ Description = "hosted content filter policies" ScriptBlock = { Get-HostedContentFilterPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "HostedContentFilterPolicies" }, [PSCustomObject]@{ Description = "hosted content filter rules" ScriptBlock = { Get-HostedContentFilterRule | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "HostedContentFilterRules" }, [PSCustomObject]@{ Description = "outbound spam filter policies" ScriptBlock = { Get-HostedOutboundSpamFilterPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "HostedOutboundSpamFilterPolicies" }, [PSCustomObject]@{ Description = "DomainKeys Identified Mail (DKIM) signing configurations" ScriptBlock = { Get-DkimSigningConfig | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "HostedDkimSigningConfigurations" }, [PSCustomObject]@{ Description = "OWA policies" ScriptBlock = { Get-OwaMailboxPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "OwaPolicies" }, [PSCustomObject]@{ Description = "S/MIME configurations" ScriptBlock = { Get-SmimeConfig | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "SmimeConfigurations" }, [PSCustomObject]@{ Description = "mobile device mailbox policies" ScriptBlock = { Get-MobileDeviceMailboxPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "MobileDeviceMailboxPolicies" }, [PSCustomObject]@{ Description = "ActiveSync device access rules" ScriptBlock = { Get-ActiveSyncDeviceAccessRule | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "ActiveSyncDeviceAccessRules" }, [PSCustomObject]@{ Description = "ActiveSync device classes" ScriptBlock = { Get-ActiveSyncDeviceClass | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "ActiveSyncDeviceClasses" }, [PSCustomObject]@{ Description = "ActiveSync organization settings" ScriptBlock = { Get-ActiveSyncOrganizationSettings | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "ActiveSyncOrganizationSettings" }, [PSCustomObject]@{ Description = "email address policies" ScriptBlock = { Get-EmailAddressPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "EmailAddressPolicies" }, [PSCustomObject]@{ Description = "federated organization information" ScriptBlock = { foreach ($domainName in (Get-MsolDomain).Name) { $federationInformation = Get-FederationInformation -DomainName $domainName $federationInformation | Add-Member -NotePropertyName "DomainName" -NotePropertyValue $domainName -Force $federationInformation | Select-Object -Property * -ExcludeProperty "RunspaceId" } } VariableName = "FederatedOrganizationInformation" }, [PSCustomObject]@{ Description = "federation trusts" ScriptBlock = { Get-FederationTrust | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "FederationTrusts" }, [PSCustomObject]@{ Description = "hybrid mail flow" ScriptBlock = { Get-HybridMailFlow | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "HybridMailFlow" }, [PSCustomObject]@{ Description = "hybrid mail flow datacenter IPs" ScriptBlock = { Get-HybridMailFlowDatacenterIPs | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "HybridMailFlowDatacenterIPs" }, [PSCustomObject]@{ Description = "intra-organization connectors" ScriptBlock = { Get-IntraOrganizationConnector | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "IntraOrganizationConnectors" }, [PSCustomObject]@{ Description = "transport configurations" ScriptBlock = { Get-TransportConfig | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "TransportConfigurations" }, [PSCustomObject]@{ Description = "inbound connectors" ScriptBlock = { Get-InboundConnector | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "InboundConnectors" }, [PSCustomObject]@{ Description = "outbound connectors" ScriptBlock = { Get-OutboundConnector | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "OutboundConnectors" }, [PSCustomObject]@{ Description = "accepted domains" ScriptBlock = { Get-AcceptedDomain | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "AcceptedDomains" }, [PSCustomObject]@{ Description = "remote domains" ScriptBlock = { Get-RemoteDomain | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "RemoteDomains" } [PSCustomObject]@{ Description = "mailbox plans" ScriptBlock = { Get-MailboxPlan | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "MailboxPlans" }, [PSCustomObject]@{ Description = "apps for Outlook" ScriptBlock = { Get-App | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "AppsForOutlook" }, [PSCustomObject]@{ Description = "inbox rules" ScriptBlock = { Get-InboxRule | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "InboxRules" }, [PSCustomObject]@{ Description = "search document formats" ScriptBlock = { Get-SearchDocumentFormat | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "SearchDocumentFormats" }, [PSCustomObject]@{ Description = "migration configurations" ScriptBlock = { Get-MigrationConfig | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "MigrationConfigurations" }, [PSCustomObject]@{ Description = "migration endpoints" ScriptBlock = { Get-MigrationEndpoint | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "MigrationEndpoints" }, [PSCustomObject]@{ Description = "CAS mailbox plans" ScriptBlock = { Get-CASMailboxPlan | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "CasMailboxPlans" }, [PSCustomObject]@{ Description = "organizational units" ScriptBlock = { Get-OrganizationalUnit | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "OrganizationalUnits" }, [PSCustomObject]@{ Description = "organization configurations" ScriptBlock = { Get-OrganizationConfig | Select-Object -Property * -ExcludeProperty "RootPublicFolderMailbox", "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "OrganizationConfigurations" }, [PSCustomObject]@{ Description = "perimeter configurations" ScriptBlock = { Get-PerimeterConfig | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "PerimeterConfigurations" }, [PSCustomObject]@{ Description = "admin audit log configurations" ScriptBlock = { Get-AdminAuditLogConfig | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "AdminAuditLogConfigurations" }, [PSCustomObject]@{ Description = "mailbox admin audit bypass associations" ScriptBlock = { Get-MailboxAuditBypassAssociation | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "MailboxAdminAuditBypassAssociation" }, [PSCustomObject]@{ Description = "data encryption policies" ScriptBlock = { Get-DataEncryptionPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "DataEncryptionPolicies" }, [PSCustomObject]@{ Description = "classification rule collections" ScriptBlock = { Get-ClassificationRuleCollection | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "ClassificationRuleCollections" }, [PSCustomObject]@{ Description = "data classifications" ScriptBlock = { Get-DataClassification | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "DataClassification" }, [PSCustomObject]@{ Description = "data classification configurations" ScriptBlock = { Get-DataClassificationConfig | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "DataClassificationConfigurations" }, [PSCustomObject]@{ Description = "DLP policies" ScriptBlock = { Get-DLPPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "DlpPolicies" }, [PSCustomObject]@{ Description = "DLP policy templates" ScriptBlock = { Get-DLPPolicyTemplate | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "DlpPolicyTemplates" }, [PSCustomObject]@{ Description = "policy tip configurations" ScriptBlock = { Get-PolicyTipConfig | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "PolicyTipConfigurations" }, [PSCustomObject]@{ Description = "transport rules" ScriptBlock = { Get-TransportRule | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "TransportRules" }, [PSCustomObject]@{ Description = "transport rule actions" ScriptBlock = { Get-TransportRuleAction | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "TransportRuleActions" }, [PSCustomObject]@{ Description = "transport rule predicates" ScriptBlock = { Get-TransportRulePredicate | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "TransportRulePredicates" }, [PSCustomObject]@{ Description = "IRM configurations" ScriptBlock = { Get-IRMConfiguration | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "IrmConfigurations" }, [PSCustomObject]@{ Description = "Outlook protection rules" ScriptBlock = { Get-OutlookProtectionRule | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "OutlookProtectionRules" }, [PSCustomObject]@{ Description = "RMS templates" ScriptBlock = { Get-RMSTemplate | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "RmsTemplates" }, [PSCustomObject]@{ Description = "journal rules" ScriptBlock = { Get-JournalRule | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "JournalRules" }, [PSCustomObject]@{ Description = "message classifications" ScriptBlock = { Get-MessageClassification | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "MessageClassifications" }, [PSCustomObject]@{ Description = "retention policies" ScriptBlock = { Get-RetentionPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "RetentionPolicies" }, [PSCustomObject]@{ Description = "retention policy tags" ScriptBlock = { Get-RetentionPolicyTag | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "RetentionPolicyTags" }, [PSCustomObject]@{ Description = "Office 365 message encryption configurations" ScriptBlock = { Get-OMEConfiguration | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "Office365MessageEncryptionConfigurations" }, [PSCustomObject]@{ Description = "management roles" ScriptBlock = { Get-ManagementRole | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "ManagementRoles" }, [PSCustomObject]@{ Description = "management role assignments" ScriptBlock = { Get-ManagementRoleAssignment | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "ManagementRoleAssignment" }, [PSCustomObject]@{ Description = "role assignment policies" ScriptBlock = { Get-RoleAssignmentPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "RoleAssignmentPolicies" }, [PSCustomObject]@{ Description = "management role entries" ScriptBlock = { Get-ManagementRole | ForEach-Object -Process { Get-ManagementRoleEntry -Identity "$($_.Name)\*" | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" } | Sort-Object -Property "Identity" } VariableName = "ManagementRoleEntries" }, [PSCustomObject]@{ Description = "role groups" ScriptBlock = { Get-RoleGroup | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "RoleGroups" }, [PSCustomObject]@{ Description = "role group members" ScriptBlock = { Get-RoleGroup | ForEach-Object -Process { $roleGroup = $_ Get-RoleGroupMember -Identity $roleGroup.Name | ForEach-Object { $_ | Add-Member -NotePropertyName "RoleGroup" -NotePropertyValue $roleGroup.Name $_ } } | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "RoleGroupMembers" }, [PSCustomObject]@{ Description = "management scopes" ScriptBlock = { Get-ManagementScope | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "ManagementScopes" }, [PSCustomObject]@{ Description = "authentication servers" ScriptBlock = { Get-AuthServer | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "AuthenticationServers" }, [PSCustomObject]@{ Description = "partner applications" ScriptBlock = { Get-PartnerApplication | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "PartnerApplications" }, [PSCustomObject]@{ Description = "availability address spaces" ScriptBlock = { Get-AvailabilityAddressSpace | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "AvailabilityAddressSpaces" }, [PSCustomObject]@{ Description = "availability configurations" ScriptBlock = { Get-AvailabilityConfig | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "AvailabilityConfigurations" }, [PSCustomObject]@{ Description = "organization relationships" ScriptBlock = { Get-OrganizationRelationship | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "OrganizationRelationships" }, [PSCustomObject]@{ Description = "sharing policies" ScriptBlock = { Get-SharingPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "SharingPolicies" }, [PSCustomObject]@{ Description = "site mailbox provisioning policies" ScriptBlock = { Get-SiteMailboxProvisioningPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId", "WhenChanged", "WhenChangedUTC", "OriginatingServer" | Sort-Object -Property "Identity" } VariableName = "SiteMailboxProvisioningPolicies" }, [PSCustomObject]@{ Description = "unified messaging auto attendants" ScriptBlock = { Get-UMAutoAttendant | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "UnifiedMessagingAutoAttendants" }, [PSCustomObject]@{ Description = "unified messaging dial plans" ScriptBlock = { Get-UMDialPlan | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "UnifiedMessagingDialPlans" }, [PSCustomObject]@{ Description = "unified messaging hunt groups" ScriptBlock = { Get-UMHuntGroup | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "UnifiedMessagingHuntGroups" }, [PSCustomObject]@{ Description = "unified messaging IP gateways" ScriptBlock = { Get-UMIPGateway | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "UnifiedMessagingIPGateways" }, [PSCustomObject]@{ Description = "unified messaging mailbox policies" ScriptBlock = { Get-UMMailboxPolicy | Select-Object -Property * -ExcludeProperty "RunspaceId" | Sort-Object -Property "Identity" } VariableName = "UnifiedMessagingMailboxPolicies" } ) } |