Filip Kasaj

I can act how I want, but I can't want what I want.

User Tools

Site Tools


technet:confdatafunctions

Configuration Data Functions (custom desired state configuration)

  1. <# INTRO
  2. Let's try to have JSON configuration data for parameters of cmdlets like New, Set or Get and use PS functions to construct and all the cmdlets by a unified form aka cmdlet-less code.
  3.  
  4. JSON data can be gatthered for example via:
  5. https://microsoft365dsc.com/
  6. https://practical365.com/dsc-snapshot-microsoft365-tenant/
  7. $Credential = Get-Credential
  8. Export-M365DSCConfiguration -Components @("AADApplication", "AADConditionalAccessPolicy", "AADGroup", "AADGroupLifecyclePolicy", "AADGroupsNamingPolicy", "AADGroupsSettings", "AADNamedLocationPolicy", "AADRoleDefinition", "AADTenantDetails", "AADTokenLifetimePolicy", "EXOAcceptedDomain", "EXOActiveSyncDeviceAccessRule", "EXOAddressBookPolicy", "EXOAddressList", "EXOAntiPhishPolicy", "EXOAntiPhishRule", "EXOApplicationAccessPolicy", "EXOAtpPolicyForO365", "EXOAuthenticationPolicy", "EXOAvailabilityAddressSpace", "EXOAvailabilityConfig", "EXOCASMailboxPlan", "EXOClientAccessRule", "EXODkimSigningConfig", "EXOEmailAddressPolicy", "EXOGlobalAddressList", "EXOHostedConnectionFilterPolicy", "EXOHostedContentFilterPolicy", "EXOHostedContentFilterRule", "EXOHostedOutboundSpamFilterPolicy", "EXOHostedOutboundSpamFilterRule", "EXOInboundConnector", "EXOIntraOrganizationConnector", "EXOJournalRule", "EXOMailboxPlan", "EXOMailTips", "EXOMalwareFilterPolicy", "EXOMalwareFilterRule", "EXOManagementRole", "EXOMobileDeviceMailboxPolicy", "EXOOfflineAddressBook", "EXOOnPremisesOrganization", "EXOOrganizationConfig", "EXOOrganizationRelationship", "EXOOutboundConnector", "EXOOwaMailboxPolicy", "EXOPartnerApplication", "EXOPolicyTipConfig", "EXOQuarantinePolicy", "EXORemoteDomain", "EXORoleAssignmentPolicy", "EXOSafeAttachmentPolicy", "EXOSafeAttachmentRule", "EXOSafeLinksPolicy", "EXOSafeLinksRule", "EXOSharedMailbox", "EXOSharingPolicy", "EXOTransportConfig", "EXOTransportRule", "IntuneAppConfigurationPolicy", "IntuneAppProtectionPolicyiOS", "IntuneDeviceCategory", "IntuneDeviceCompliancePolicyAndroid", "IntuneDeviceCompliancePolicyAndroidDeviceOwner", "IntuneDeviceCompliancePolicyAndroidWorkProfile", "IntuneDeviceCompliancePolicyiOs", "IntuneDeviceCompliancePolicyMacOS", "IntuneDeviceCompliancePolicyWindows10", "IntuneDeviceConfigurationPolicyAndroidDeviceOwner", "IntuneDeviceConfigurationPolicyAndroidWorkProfile", "IntuneDeviceConfigurationPolicyiOS", "IntuneDeviceConfigurationPolicyWindows10", "IntuneDeviceEnrollmentLimitRestriction", "IntuneDeviceEnrollmentPlatformRestriction", "O365AdminAuditLogConfig", "O365OrgCustomizationSetting", "ODSettings", "PPTenantIsolationSettings", "PPTenantSettings", "SCAuditConfigurationPolicy", "SCCaseHoldPolicy", "SCCaseHoldRule", "SCComplianceCase", "SCComplianceSearch", "SCComplianceSearchAction", "SCComplianceTag", "SCDeviceConditionalAccessPolicy", "SCDeviceConfigurationPolicy", "SCDLPCompliancePolicy", "SCDLPComplianceRule", "SCFilePlanPropertyAuthority", "SCFilePlanPropertyCategory", "SCFilePlanPropertyCitation", "SCFilePlanPropertyDepartment", "SCFilePlanPropertyReferenceId", "SCFilePlanPropertySubCategory", "SCLabelPolicy", "SCRetentionCompliancePolicy", "SCRetentionComplianceRule", "SCRetentionEventType", "SCSensitivityLabel", "SCSupervisoryReviewPolicy", "SCSupervisoryReviewRule", "SPOAccessControlSettings", "SPOApp", "SPOBrowserIdleSignout", "SPOHomeSite", "SPOHubSite", "SPOOrgAssetsLibrary", "SPOSearchManagedProperty", "SPOSearchResultSource", "SPOSharingSettings", "SPOSiteDesign", "SPOSiteDesignRights", "SPOSiteScript", "SPOStorageEntity", "SPOTenantCdnEnabled", "SPOTenantCdnPolicy", "SPOTenantSettings", "SPOTheme", "TeamsCallingPolicy", "TeamsChannel", "TeamsChannelsPolicy", "TeamsClientConfiguration", "TeamsEmergencyCallingPolicy", "TeamsEmergencyCallRoutingPolicy", "TeamsFederationConfiguration", "TeamsGuestCallingConfiguration", "TeamsGuestMeetingConfiguration", "TeamsGuestMessagingConfiguration", "TeamsMeetingBroadcastConfiguration", "TeamsMeetingBroadcastPolicy", "TeamsMeetingConfiguration", "TeamsMeetingPolicy", "TeamsMessagingPolicy", "TeamsPstnUsage", "TeamsTenantDialPlan", "TeamsUpgradeConfiguration", "TeamsUpgradePolicy", "TeamsVoiceRoute", "TeamsVoiceRoutingPolicy") -Credential $Credential -Path "C:\DSC"
  9. New-M365DSCReportFromConfiguration -Type html -ConfigurationPath -OutputPath
  10. New-M365DSCReportFromConfiguration -Type excel -ConfigurationPath -OutputPath
  11. New-M365DSCDeltaReport -Source -Destination -OutputPath ".html"
  12. #>
  13.  
  14. # Example below for EXO settings
  15.  
  16. # EXO CONFIGURATION (JSON)
  17.  
  18. #region InboundConnector
  19. $InboundConnector ='{
  20. "Id": "From GW to EXO",
  21. "Type": "EXO",
  22. "Action": "New-InboundConnector",
  23. "Test": "Get-InboundConnector",
  24. "Data": {
  25. "TreatMessagesAsInternal": false,
  26. "RestrictDomainsToIPAddresses": false,
  27. "Name": "From GW to EXO",
  28. "RequireTls": true,
  29. "CloudServicesMailEnabled": true,
  30. "ConnectorSource": "Default",
  31. "ConnectorType": "OnPremises",
  32. "SenderIPAddresses": [],
  33. "Comment": "From GW to EXO",
  34. "SenderDomains": "smtp:*;1",
  35. "AssociatedAcceptedDomains": [],
  36. "Enabled": true,
  37. "RestrictDomainsToCertificate": true,
  38. "TlsSenderCertificateName": "*.kasaj.cz"
  39. }
  40. }'
  41. #endregion
  42.  
  43. #region OutboundConnetor
  44. $OutboundConnector = '{
  45. "Id": "From EXO to GW",
  46. "Type": "EXO",
  47. "Action": "New-OutboundConnector",
  48. "Test": "Get-OutboundConnector",
  49. "Data": {
  50. "RouteAllMessagesViaOnPremises": false,
  51. "Enabled": true,
  52. "CloudServicesMailEnabled": true,
  53. "UseMxRecord": false,
  54. "SmartHosts": ["wes1-mx1.wedos.net","wes1-mx2.wedos.net"],
  55. "TlsSettings": "CertificateValidation",
  56. "RecipientDomains": [],
  57. "Name": "From EXO to GW",
  58. "Comment": "From EXO to GW, TR in use",
  59. "IsTransportRuleScoped": true,
  60. "ConnectorSource": "Default",
  61. "TestMode": false,
  62. "AllAcceptedDomains": false,
  63. "ConnectorType": "OnPremises"
  64. }
  65. }'
  66. #endregion
  67.  
  68. #region TransportRule
  69. $TransportRule = '[{
  70. "Id": "TR - Block External Delivery to onmicrosoft.com domains",
  71. "Type": "EXO",
  72. "Action": "New-TransportRule",
  73. "Test": "Get-TransportRule -Identity $Id",
  74. "Data": {
  75. "ExceptIfAttachmentProcessingLimitExceeded": false,
  76. "ExceptIfAttachmentHasExecutableContent": false,
  77. "RecipientAddressContainsWords": ["M365x11772468.onmicrosoft.com","M365x11772468.mail.onmicrosoft.com"],
  78. "RuleSubType": "None",
  79. "ApplyOME": false,
  80. "AttachmentIsUnsupported": false,
  81. "ExceptIfAttachmentIsUnsupported": false,
  82. "ExceptIfHeaderMatchesMessageHeader": "X-RoutedThroughGW",
  83. "ModerateMessageByManager": false,
  84. "RouteMessageOutboundRequireTls": false,
  85. "Mode": "Enforce",
  86. "RejectMessageEnhancedStatusCode": "5.7.1",
  87. "AttachmentHasExecutableContent": false,
  88. "ExceptIfHasSenderOverride": false,
  89. "AttachmentProcessingLimitExceeded": false,
  90. "DeleteMessage": false,
  91. "ExceptIfHeaderMatchesPatterns": "Yes",
  92. "RuleErrorAction": "Ignore",
  93. "HasSenderOverride": false,
  94. "ExceptIfHasNoClassification": false,
  95. "HasNoClassification": false,
  96. "RejectMessageReasonText": "External delivery not allowed to onmicrosoft.com addresses",
  97. "Priority": 4,
  98. "AttachmentIsPasswordProtected": false,
  99. "FromScope": "NotInOrganization",
  100. "RemoveOMEv2": false,
  101. "RemoveOME": false,
  102. "SenderAddressLocation": "Header",
  103. "Name": "TR - Block External Delivery to onmicrosoft.com domains",
  104. "ExceptIfAttachmentIsPasswordProtected": false,
  105. "StopRuleProcessing": true
  106. }
  107. },
  108. {
  109. "Id": "TR - From EXO to GW",
  110. "Type": "EXO",
  111. "Action": "New-TransportRule",
  112. "Test": "Get-TransportRule -Identity $Id",
  113. "Data": {
  114. "ExceptIfAttachmentProcessingLimitExceeded": false,
  115. "ExceptIfAttachmentHasExecutableContent": false,
  116. "RemoveOMEv2": false,
  117. "ApplyOME": false,
  118. "AttachmentIsUnsupported": false,
  119. "ExceptIfAttachmentIsUnsupported": false,
  120. "ExceptIfHeaderMatchesMessageHeader": "X-HD1",
  121. "ModerateMessageByManager": false,
  122. "RouteMessageOutboundRequireTls": false,
  123. "Mode": "Enforce",
  124. "AttachmentHasExecutableContent": false,
  125. "ExceptIfHasSenderOverride": false,
  126. "AttachmentProcessingLimitExceeded": false,
  127. "RouteMessageOutboundConnector": "From EXO to GW",
  128. "DeleteMessage": false,
  129. "ExceptIfHeaderMatchesPatterns": "Yes",
  130. "RuleSubType": "None",
  131. "HasSenderOverride": false,
  132. "ExceptIfHasNoClassification": false,
  133. "HasNoClassification": false,
  134. "SentToScope": "NotInOrganization",
  135. "Priority": 2,
  136. "AttachmentIsPasswordProtected": false,
  137. "RuleErrorAction": "Ignore",
  138. "RemoveOME": false,
  139. "SenderAddressLocation": "Header",
  140. "Name": "TR - From EXO to GW",
  141. "ExceptIfAttachmentIsPasswordProtected": false,
  142. "StopRuleProcessing": true
  143. }
  144. }]'
  145. #endregion
  146.  
  147. #region RemoteDomain
  148. $RemoteDomain ='{
  149. "Id": "Default",
  150. "Type": "EXO",
  151. "Action": "Set-RemoteDomain",
  152. "Test": "Get-RemoteDomain",
  153. "Data":
  154. {
  155. "IsInternal": false,
  156. "TargetDeliveryDomain": false,
  157. "ByteEncoderTypeFor7BitCharsets": "Undefined",
  158. "CharacterSet": "iso-8859-1",
  159. "NonMimeCharacterSet": "iso-8859-1",
  160. "AllowedOOFType": "External",
  161. "AutoReplyEnabled": false,
  162. "AutoForwardEnabled": false,
  163. "DeliveryReportEnabled": true,
  164. "NDREnabled": true,
  165. "MeetingForwardNotificationEnabled": true,
  166. "ContentType": "MimeHtmlText",
  167. "DisplaySenderName": false,
  168. "PreferredInternetCodePageForShiftJis": "Undefined",
  169. "RequiredCharsetCoverage": null,
  170. "TNEFEnabled": null,
  171. "LineWrapSize": "Unlimited",
  172. "TrustedMailOutboundEnabled": false,
  173. "TrustedMailInboundEnabled": false,
  174. "UseSimpleDisplayName": false,
  175. "NDRDiagnosticInfoEnabled": true,
  176. "Identity": "Default"
  177. }
  178. }'
  179.  
  180. #endregion
  181.  
  182. #region TransportConfiguration
  183. $TransportConfig = '{
  184. "Id": "b707e374f337438b8edd5a4feb7934e5",
  185. "Type": "EXO",
  186. "Action": "Set-TransportConfig",
  187. "Test": "Get-TransportConfig",
  188. "Data": {
  189. "AllowLegacyTLSClients": false,
  190. "HeaderPromotionModeSetting": "NoCreate",
  191. "ReplyAllStormBlockDurationHours": 6,
  192. "ReplyAllStormDetectionMinimumRecipients": 2500,
  193. "ReplyAllStormProtectionEnabled": true,
  194. "Rfc2231EncodingEnabled": false,
  195. "ExternalDsnSendHtml": true,
  196. "DSNConversionMode": "PreserveDSNBody",
  197. "ClearCategories": true,
  198. "ExternalDsnLanguageDetectionEnabled": true,
  199. "ReplyAllStormDetectionMinimumReplies": 10,
  200. "JournalMessageExpirationDays": 0,
  201. "InternalDsnSendHtml": true,
  202. "AddressBookPolicyRoutingEnabled": false,
  203. "ExternalDelayDsnEnabled": true,
  204. "InternalDsnLanguageDetectionEnabled": true,
  205. "SmtpClientAuthenticationDisabled": true,
  206. "ConvertDisclaimerWrapperToEml": false,
  207. "MaxRecipientEnvelopeLimit": "Unlimited",
  208. "InternalDelayDsnEnabled": true,
  209. "JournalingReportNdrTo": "\u003c\u003e"
  210. },
  211. }'
  212.  
  213. #endregion
  214.  
  215. #region OrganizationConfig
  216. $OrganizationConfig = '{
  217. "Id": "OrganizationConfig",
  218. "Type": "EXO",
  219. "Action": "Set-OrganizationConfig",
  220. "Test": "Get-OrganizationConfig",
  221. "Data": {
  222. "ShortenEventScopeDefault": "none",
  223. "ExchangeNotificationEnabled": true,
  224. "MailTipsLargeAudienceThreshold": 25,
  225. "ConnectorsEnabledForOutlook": false,
  226. "OutlookGifPickerDisabled": false,
  227. "AllowPlusAddressInRecipients": false,
  228. "MailTipsExternalRecipientsTipsEnabled": true,
  229. "AsyncSendEnabled": true,
  230. "ActivityBasedAuthenticationTimeoutEnabled": true,
  231. "LinkPreviewEnabled": true,
  232. "DefaultGroupAccessType": "Private",
  233. "CustomerLockboxEnabled": false,
  234. "OutlookMobileGCCRestrictionsEnabled": false,
  235. "DistributionGroupNameBlockedWordsList": [],
  236. "VisibleMeetingUpdateProperties": "Location,AllProperties:15",
  237. "ConnectorsEnabledForSharepoint": true,
  238. "SendFromAliasEnabled": false,
  239. "ElcProcessingDisabled": false,
  240. "WebPushNotificationsDisabled": false,
  241. "WebSuggestedRepliesDisabled": false,
  242. "DefaultPublicFolderProhibitPostQuota": "2 GB (2,147,483,648 bytes)",
  243. "ReadTrackingEnabled": false,
  244. "AppsForOfficeEnabled": false,
  245. "MessageRemindersEnabled": true,
  246. "RemotePublicFolderMailboxes": [],
  247. "ConnectorsActionableMessagesEnabled": true,
  248. "MobileAppEducationEnabled": true,
  249. "ConnectorsEnabledForTeams": true,
  250. "DisablePlusAddressInRecipients": true,
  251. "AuditDisabled": false,
  252. "BookingsSocialSharingRestricted": true,
  253. "OAuth2ClientProfileEnabled": true,
  254. "EndUserDLUpgradeFlowsDisabled": true,
  255. "ByteEncoderTypeFor7BitCharsets": 0,
  256. "DirectReportsGroupAutoCreationEnabled": false,
  257. "ActivityBasedAuthenticationTimeoutWithSingleSignOnEnabled": true,
  258. "DefaultPublicFolderMovedItemRetention": "7.00:00:00",
  259. "SmtpActionableMessagesEnabled": true,
  260. "DefaultPublicFolderDeletedItemRetention": "30.00:00:00",
  261. "LeanPopoutEnabled": false,
  262. "ActivityBasedAuthenticationTimeoutInterval": "06:00:00",
  263. "DefaultPublicFolderMaxItemSize": "Unlimited",
  264. "DefaultPublicFolderIssueWarningQuota": "1.7 GB (1,825,361,920 bytes)",
  265. "BookingsPaymentsEnabled": false,
  266. "IPListBlocked": [],
  267. "ConnectorsEnabled": false,
  268. "ExchangeNotificationRecipients": [],
  269. "BookingsEnabled": false,
  270. "MailTipsGroupMetricsEnabled": true,
  271. "PublicComputersDetectionEnabled": false,
  272. "OutlookPayEnabled": false,
  273. "MailTipsAllTipsEnabled": true,
  274. "PublicFoldersEnabled": "Local",
  275. "ConnectorsEnabledForYammer": false,
  276. "PublicFolderShowClientControl": false,
  277. "DistributionGroupNamingPolicy": "",
  278. "MailTipsMailboxSourcedTipsEnabled": true
  279. }
  280. }'
  281. #endregion
  282.  
  283. #region HostedContentFilterPolicy
  284. $HostedContentFilterPolicy = '{
  285. "Id": "c5b2629579c2467f8e446457a19bae7e",
  286. "Type": "EXO",
  287. "Name": "HostedContentFilterPolicy",
  288. "Action": "New",
  289. "Data": {
  290. "InlineSafetyTipsEnabled": true,
  291. "MarkAsSpamJavaScriptInHtml": "Off",
  292. "Identity": "Default",
  293. "SpamZapEnabled": true,
  294. "EndUserSpamNotificationLanguage": "Default",
  295. "SpamAction": "MoveToJmf",
  296. "MakeDefault": true,
  297. "HighConfidenceSpamAction": "MoveToJmf",
  298. "EndUserSpamNotificationFrequency": 3,
  299. "TestModeBccToRecipients": [
  300.  
  301. ],
  302. "HighConfidencePhishAction": "Quarantine",
  303. "BulkThreshold": 7,
  304. "PhishSpamAction": "MoveToJmf",
  305. "DownloadLink": false,
  306. "PhishZapEnabled": true,
  307. "MarkAsSpamObjectTagsInHtml": "Off",
  308. "MarkAsSpamFramesInHtml": "Off",
  309. "EndUserSpamNotificationCustomSubject": "",
  310. "RedirectToRecipients": [
  311.  
  312. ],
  313. "BulkSpamAction": "MoveToJmf",
  314. "LanguageBlockList": [
  315.  
  316. ],
  317. "QuarantineRetentionPeriod": 15,
  318. "EnableEndUserSpamNotifications": false,
  319. "MarkAsSpamBulkMail": "On",
  320. "IncreaseScoreWithNumericIps": "Off",
  321. "MarkAsSpamEmbedTagsInHtml": "Off",
  322. "MarkAsSpamSensitiveWordList": "Off",
  323. "RegionBlockList": [
  324.  
  325. ],
  326. "MarkAsSpamFromAddressAuthFail": "Off",
  327. "EnableLanguageBlockList": false,
  328. "MarkAsSpamEmptyMessages": "Off",
  329. "EnableRegionBlockList": false,
  330. "AddXHeaderValue": "",
  331. "IncreaseScoreWithBizOrInfoUrls": "Off",
  332. "MarkAsSpamSpfRecordHardFail": "Off",
  333. "AdminDisplayName": "",
  334. "MarkAsSpamWebBugsInHtml": "Off",
  335. "TestModeAction": "None",
  336. "MarkAsSpamNdrBackscatter": "Off",
  337. "MarkAsSpamFormTagsInHtml": "Off",
  338. "ModifySubjectValue": "",
  339. "IncreaseScoreWithImageLinks": "Off",
  340. "IncreaseScoreWithRedirectToOtherPort": "Off"
  341. },
  342. "Permission": "Exchange Administrator"
  343. }
  344. '
  345. #endregion
  346.  
  347. #region HostedConnectionFilterPolicy
  348. $HostedConnectionFilterPolicy = '{
  349. "Id": "92755ec5ff4e48aeb4c3e7a8cd747619",
  350. "Type": "EXO",
  351. "Name": "HostedConnectionFilterPolicy",
  352. "Action": "New",
  353. "Data": {
  354. "AdminDisplayName": "",
  355. "IPBlockList": [
  356.  
  357. ],
  358. "Identity": "Default",
  359. "EnableSafeList": false,
  360. "MakeDefault": false,
  361. "IPAllowList": [
  362.  
  363. ]
  364. },
  365. "Permission": "Exchange Administrator"
  366. }'
  367. #endregion
  368.  
  369. # FUNCTIONS
  370. Function Compare-ObjectProperties {
  371. Param(
  372. [PSObject]$ReferenceObject,
  373. [PSObject]$DifferenceObject
  374. )
  375. $objprops = $ReferenceObject | Get-Member -MemberType Property,NoteProperty | % Name
  376. $objprops += $DifferenceObject | Get-Member -MemberType Property,NoteProperty | % Name
  377. $objprops = $objprops | Sort | Select -Unique
  378. $diffs = @()
  379. foreach ($objprop in $objprops) {
  380. $diff = Compare-Object $ReferenceObject $DifferenceObject -Property $objprop
  381. if ($diff) {
  382. $diffprops = @{
  383. PropertyName=$objprop
  384. RefValue=($diff | ? {$_.SideIndicator -eq '<='} | % $($objprop))
  385. DiffValue=($diff | ? {$_.SideIndicator -eq '=>'} | % $($objprop))
  386. }
  387. $diffs += New-Object PSObject -Property $diffprops
  388. }
  389. }
  390. if ($diffs) {
  391. return ($diffs | Select PropertyName,RefValue,DiffValue)
  392. }
  393. }
  394.  
  395. function Start-ConfAction ($Act,$Data,$Force,$Prop, $Ver){
  396. $Members = $Data|gm|where MemberType -eq "NoteProperty"|%{$_.name}
  397. [string] $Cmdlet = $act
  398. [string] $CmdletInc = $act
  399. foreach($Member in $Members){
  400. $Cmdlet += " -"+$Member+' $Data.'+$Member
  401. if($Prop -and ($Prop -contains $Member)){
  402. $CmdletInc += " -"+$Member+' $Data.'+$Member
  403. }
  404. }
  405. if($Prop){
  406. if($Ver){
  407. $CmdletInc += ' -Verbose -WhatIf'
  408. }
  409. $CmdletInc
  410. }else{
  411. $Cmdlet
  412. }
  413. if($force -like "f*"){
  414. if($Prop){
  415. Invoke-Expression -Command $CmdletInc
  416. }else{
  417. Invoke-Expression -Command $Cmdlet
  418. }
  419. }
  420. }
  421.  
  422. function Test-ConfData ($Conf){
  423. $Error.Clear()
  424. $Data = $Conf.data
  425. $Id = $conf.Id
  426. $Members = $Data|gm|where MemberType -eq "NoteProperty"|%{$_.name}
  427. $Get = Invoke-Expression -Command $Conf.Test |select -Property $Members
  428. if($Get){
  429. $Comp = Compare-ObjectProperties $Data $Get
  430. }
  431. if($comp -and $Get -and !$error){
  432. $comp
  433. }elseif(!$comp -and $Get -and !$error){
  434. "OK"
  435. }else{
  436. "Not detected!"
  437. }
  438. }
  439.  
  440.  
  441. # MAIN
  442.  
  443. Connect-ExchangeOnline
  444. Connect-IPPSSession
  445.  
  446. #region InboundConnector
  447. $Conf = @()
  448. $Conf = $InboundConnector | ConvertFrom-Json
  449. $Conf.data
  450.  
  451. <# Output example:
  452.  
  453.   Enabled : True
  454.   ConnectorType : OnPremises
  455.   Comment : Inbound from GW
  456.   SenderIPAddresses : {}
  457.   SenderDomains : {smtp:*;1}
  458.   TrustedOrganizations : {}
  459.   AssociatedAcceptedDomains : {}
  460.   RequireTls : True
  461.   RestrictDomainsToIPAddresses : False
  462.   RestrictDomainsToCertificate : True
  463.   CloudServicesMailEnabled : True
  464.   TreatMessagesAsInternal : False
  465.   TlsSenderCertificateName : *.kasaj.cz
  466.   EFTestMode : False
  467.   ScanAndDropRecipients : {}
  468.   EFSkipLastIP : False
  469.   EFSkipIPs : {}
  470.   EFSkipMailGateway : {}
  471.   EFUsers : {}
  472.   Name : Inbound from GW
  473.   #>
  474.  
  475. Test-ConfData $Conf
  476.  
  477. <# Output example:
  478.  
  479.   PropertyName RefValue DiffValue
  480.   ------------ -------- ---------
  481.   Comment Inbound from GW Connector disabled
  482.   Enabled True False
  483.   #>
  484.  
  485. Start-ConfAction $Conf.Action $Conf.Data
  486.  
  487. <# Output example:
  488.   New-InboundConnector -AssociatedAcceptedDomains $Data.AssociatedAcceptedDomains -CloudServicesMailEnabled $Data.CloudServicesMailEnabled -Comment $Data.Comment -ConnectorType $Data.ConnectorType -EFSkipIPs $Data.EFSkipIPs -EFSkipLastIP $Data.EFSkipLastIP -EFSkipMailGateway $Data.EFSkipMailGateway -EFTestMode $Data.EFTestMode -EFUsers $Data.EFUsers -Enabled $Data.Enabled -Name $Data.Name -RequireTls $Data.RequireTls -RestrictDomainsToCertificate $Data.RestrictDomainsToCertificate -RestrictDomainsToIPAddresses $Data.RestrictDomainsToIPAddresses -ScanAndDropRecipients $Data.ScanAndDropRecipients -SenderDomains $Data.SenderDomains -SenderIPAddresses $Data.SenderIPAddresses -TlsSenderCertificateName $Data.TlsSenderCertificateName -TreatMessagesAsInternal $Data.TreatMessagesAsInternal -TrustedOrganizations $Data.TrustedOrganizations
  489.   #>
  490.  
  491. Start-ConfAction $Conf.Action $Conf.Data force
  492. # Start-ConfAction "Set-InboundConnector -identity 'Outbound to GW'" $Conf.Data force
  493. #endregion
  494.  
  495. #region OutboundConnector
  496. $Conf = @()
  497. $Conf = $OutboundConnector | ConvertFrom-Json
  498. $Conf.data
  499. Test-ConfData $Conf
  500. Start-ConfAction $Conf.Action $Conf.Data nonforce $((Test-ConfData $Conf).PropertyName)
  501. Start-ConfAction $Conf.Action $Conf.Data nonforce $((Test-ConfData $Conf).PropertyName) "ver"
  502. Start-ConfAction $Conf.Action $Conf.Data force
  503. # Start-ConfAction "Set-OrganizationConfig" $Conf.Data nonforce $Conf.Data force $((Test-ConfData $Conf).PropertyName) "V"
  504. # Start-ConfAction "Set-OrganizationConfig" $Conf.Data force
  505. #endregion
  506.  
  507. #region TransporRule
  508. $Conf = @()
  509. $Conf = $TransportRule| ConvertFrom-Json
  510. $Conf[0].data
  511. Test-ConfData $Conf[0]
  512. Start-ConfAction $Conf[0].Action $Conf[0].Data
  513. Start-ConfAction $Conf[0].Action $Conf[0].Data force
  514. # Start-ConfAction "Set-TransportRule -identity 'TR - Block External Delivery to onmicrosoft.com domains'" $Conf[0].Data nonforce $((Test-ConfData $Conf[0]).PropertyName)
  515. # Start-ConfAction "Set-TransportRule -identity 'TR - Block External Delivery to onmicrosoft.com domains'" $Conf[0].Data force
  516. $Conf[1].data
  517. Test-ConfData $Conf[1]
  518. Start-ConfAction $Conf[1].Action $Conf[1].Data
  519. Start-ConfAction $Conf[1].Action $Conf[1].Data force
  520. # Start-ConfAction "Set-TransportRule -identity 'TR - From EXO to GW'" $Conf.Data force
  521. #endregion
  522.  
  523. #region RemoteDomain
  524. $Conf = @()
  525. $Conf = $RemoteDomain | ConvertFrom-Json
  526. $Conf.data
  527. Test-ConfData $Conf
  528. Start-ConfAction $Conf.Action $Conf.Data nonforce $((Test-ConfData $Conf).PropertyName)
  529. Start-ConfAction $Conf.Action $Conf.Data force
  530. #endregion
  531.  
  532. #region OrganizationConfig
  533. $Conf = @()
  534. $Conf = $OrganizationConfig | ConvertFrom-Json
  535. $Conf.data
  536. Test-ConfData $Conf
  537. Start-ConfAction $Conf.Action $Conf.Data force $((Test-ConfData $Conf).PropertyName+"ShortenEventScopeDefault") "what"
  538. Start-ConfAction $Conf.Action $Conf.Data force
  539. #endregion
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
technet/confdatafunctions.txt · Last modified: 2023/06/14 09:43 by A User Not Logged in