From 329603ad166bdd5719ac29f127e4adcb7bc4d561 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 19 May 2021 10:13:45 -0400 Subject: [PATCH 1/8] Progressive Save --- .../MSFT_AADApplication.psm1 | 2 + .../MSFT_AADConditionalAccessPolicy.psm1 | 6 +- .../MSFT_AADGroupsNamingPolicy.psm1 | 7 +- .../MSFT_AADGroupsSettings.psm1 | 59 +- .../MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 | 6 +- .../MSFT_AADMSGroupLifecyclePolicy.psm1 | 7 +- .../MSFT_AADNamedLocationPolicy.psm1 | 6 +- .../MSFT_AADPolicy/MSFT_AADPolicy.psm1 | 8 +- .../MSFT_AADRoleDefinition.psm1 | 7 +- .../MSFT_AADServicePrincipal.psm1 | 6 +- .../MSFT_AADTenantDetails.psm1 | 9 +- .../MSFT_EXOAcceptedDomain.psm1 | 5 +- .../MSFT_EXOActiveSyncDeviceAccessRule.psm1 | 10 +- .../MSFT_EXOAddressBookPolicy.psm1 | 9 +- .../MSFT_EXOAddressList.psm1 | 6 +- .../MSFT_EXOAntiPhishPolicy.psm1 | 6 +- .../MSFT_EXOAntiPhishRule.psm1 | 6 +- .../MSFT_EXOApplicationAccessPolicy.psm1 | 10 +- .../MSFT_EXOAtpPolicyForO365.psm1 | 7 +- .../MSFT_EXOAvailabilityAddressSpace.psm1 | 6 +- .../MSFT_EXOAvailabilityConfig.psm1 | 5 +- .../MSFT_EXOCASMailboxPlan.psm1 | 6 +- .../MSFT_EXOClientAccessRule.psm1 | 6 +- .../MSFT_EXODkimSigningConfig.psm1 | 5 +- .../MSFT_EXOEmailAddressPolicy.psm1 | 5 +- .../MSFT_EXOGlobalAddressList.psm1 | 5 +- .../MSFT_EXOHostedConnectionFilterPolicy.psm1 | 5 +- .../MSFT_EXOHostedContentFilterPolicy.psm1 | 5 +- .../MSFT_EXOHostedContentFilterRule.psm1 | 5 +- ...SFT_EXOHostedOutboundSpamFilterPolicy.psm1 | 5 +- .../MSFT_EXOInboundConnector.psm1 | 5 +- .../MSFT_EXOIntraOrganizationConnector.psm1 | 5 +- .../MSFT_EXOMailTips/MSFT_EXOMailTips.psm1 | 5 +- .../MSFT_EXOMailboxSettings.psm1 | 9 +- .../MSFT_EXOMalwareFilterPolicy.psm1 | 5 +- .../MSFT_EXOMalwareFilterRule.psm1 | 5 +- .../MSFT_EXOManagementRole.psm1 | 5 +- .../MSFT_EXOMobileDeviceMailboxPolicy.psm1 | 5 +- .../MSFT_EXOOfflineAddressBook.psm1 | 15 +- .../MSFT_EXOOnPremisesOrganization.psm1 | 5 +- .../MSFT_EXOOrganizationConfig.psm1 | 5 +- .../MSFT_EXOOrganizationRelationship.psm1 | 5 +- .../MSFT_EXOOutboundConnector.psm1 | 5 +- .../MSFT_EXOOwaMailboxPolicy.psm1 | 5 +- .../MSFT_EXOPartnerApplication.psm1 | 5 +- .../MSFT_EXOPolicyTipConfig.psm1 | 5 +- .../MSFT_EXORemoteDomain.psm1 | 5 +- .../MSFT_EXORoleAssignmentPolicy.psm1 | 5 +- .../MSFT_EXOSafeAttachmentPolicy.psm1 | 5 +- .../MSFT_EXOSafeAttachmentRule.psm1 | 5 +- .../MSFT_EXOSafeLinksPolicy.psm1 | 5 +- .../MSFT_EXOSafeLinksRule.psm1 | 5 +- .../MSFT_EXOSharedMailbox.psm1 | 5 +- .../MSFT_EXOSharingPolicy.psm1 | 5 +- .../MSFT_EXOTransportRule.psm1 | 5 +- .../MSFT_IntuneAppConfigurationPolicy.psm1 | 17 +- .../MSFT_IntuneAppProtectionPolicyiOS.psm1 | 22 +- .../MSFT_IntuneDeviceCategory.psm1 | 22 +- ...T_IntuneDeviceCompliancePolicyAndroid.psm1 | 22 +- ...iceCompliancePolicyAndroidWorkProfile.psm1 | 22 +- .../MSFT_IntuneDeviceCompliancePolicyiOs.psm1 | 22 +- ...FT_IntuneDeviceConfigurationPolicyiOS.psm1 | 22 +- ...ntuneDeviceEnrollmentLimitRestriction.psm1 | 22 +- ...neDeviceEnrollmentPlatformRestriction.psm1 | 22 +- .../MSFT_O365AdminAuditLogConfig.psm1 | 8 +- .../MSFT_O365Group/MSFT_O365Group.psm1 | 6 +- .../MSFT_O365OrgCustomizationSetting.psm1 | 6 +- .../MSFT_O365User/MSFT_O365User.psm1 | 9 +- .../MSFT_ODSettings/MSFT_ODSettings.psm1 | 7 +- .../MSFT_PPPowerAppsEnvironment.psm1 | 6 +- .../MSFT_PlannerBucket.psm1 | 22 +- .../MSFT_PlannerPlan/MSFT_PlannerPlan.psm1 | 22 +- .../MSFT_PlannerTask/MSFT_PlannerTask.psm1 | 32 +- .../MSFT_SCAuditConfigurationPolicy.psm1 | 5 +- .../MSFT_SCCaseHoldPolicy.psm1 | 6 +- .../MSFT_SCCaseHoldRule.psm1 | 5 +- .../MSFT_SCComplianceCase.psm1 | 6 +- .../MSFT_SCComplianceSearch.psm1 | 6 +- .../MSFT_SCComplianceSearchAction.psm1 | 5 +- .../MSFT_SCComplianceTag.psm1 | 2 + .../MSFT_SCDLPCompliancePolicy.psm1 | 5 +- .../MSFT_SCDLPComplianceRule.psm1 | 3 + .../MSFT_SCDeviceConditionalAccessPolicy.psm1 | 5 +- .../MSFT_SCDeviceConfigurationPolicy.psm1 | 5 +- .../MSFT_SCFilePlanPropertyAuthority.psm1 | 5 +- .../MSFT_SCFilePlanPropertyCategory.psm1 | 5 +- .../MSFT_SCFilePlanPropertyCitation.psm1 | 5 +- .../MSFT_SCFilePlanPropertyDepartment.psm1 | 5 +- .../MSFT_SCFilePlanPropertyReferenceId.psm1 | 5 +- .../MSFT_SCFilePlanPropertySubCategory.psm1 | 5 +- .../MSFT_SCLabelPolicy.psm1 | 2 + .../MSFT_SCRetentionCompliancePolicy.psm1 | 5 +- .../MSFT_SCRetentionComplianceRule.psm1 | 5 +- .../MSFT_SCRetentionEventType.psm1 | 5 +- .../MSFT_SCSensitivityLabel.psm1 | 2 + .../MSFT_SCSupervisoryReviewPolicy.psm1 | 5 +- .../MSFT_SCSupervisoryReviewRule.psm1 | 5 +- .../MSFT_SPOAccessControlSettings.psm1 | 6 +- .../DSCResources/MSFT_SPOApp/MSFT_SPOApp.psm1 | 5 +- .../MSFT_SPOBrowserIdleSignout.psm1 | 6 +- .../MSFT_SPOHomeSite/MSFT_SPOHomeSite.psm1 | 6 +- .../MSFT_SPOHubSite/MSFT_SPOHubSite.psm1 | 15 +- .../MSFT_SPOOrgAssetsLibrary.psm1 | 5 +- .../MSFT_SPOPropertyBag.psm1 | 5 +- .../MSFT_SPOSearchManagedProperty.psm1 | 7 +- .../MSFT_SPOSearchResultSource.psm1 | 5 +- .../MSFT_SPOSharingSettings.psm1 | 5 +- .../MSFT_SPOSite/MSFT_SPOSite.psm1 | 14 +- .../MSFT_SPOSiteAuditSettings.psm1 | 12 +- .../MSFT_SPOSiteDesign.psm1 | 6 +- .../MSFT_SPOSiteDesignRights.psm1 | 12 +- .../MSFT_SPOSiteGroup/MSFT_SPOSiteGroup.psm1 | 17 +- .../MSFT_SPOSiteScript.psm1 | 5 +- .../MSFT_SPOStorageEntity.psm1 | 14 +- .../MSFT_SPOTenantCdnEnabled.psm1 | 5 +- .../MSFT_SPOTenantCdnPolicy.psm1 | 5 +- .../MSFT_SPOTenantSettings.psm1 | 5 +- .../MSFT_SPOTheme/MSFT_SPOTheme.psm1 | 8 +- .../MSFT_SPOUserProfileProperty.psm1 | 5 +- .../MSFT_TeamsCallingPolicy.psm1 | 22 +- .../MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 | 17 +- .../MSFT_TeamsChannelTab.psm1 | 5 +- .../MSFT_TeamsChannelsPolicy.psm1 | 22 +- .../MSFT_TeamsClientConfiguration.psm1 | 21 +- .../MSFT_TeamsEmergencyCallRoutingPolicy.psm1 | 17 +- .../MSFT_TeamsEmergencyCallingPolicy.psm1 | 27 +- .../MSFT_TeamsGuestCallingConfiguration.psm1 | 21 +- .../MSFT_TeamsGuestMeetingConfiguration.psm1 | 21 +- ...MSFT_TeamsGuestMessagingConfiguration.psm1 | 21 +- ...FT_TeamsMeetingBroadcastConfiguration.psm1 | 27 +- .../MSFT_TeamsMeetingBroadcastPolicy.psm1 | 23 +- .../MSFT_TeamsMeetingConfiguration.psm1 | 21 +- .../MSFT_TeamsMeetingPolicy.psm1 | 22 +- .../MSFT_TeamsMessagingPolicy.psm1 | 22 +- .../MSFT_TeamsPstnUsage.psm1 | 22 +- .../MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 | 24 +- .../MSFT_TeamsTenantDialPlan.psm1 | 19 +- .../MSFT_TeamsUpgradeConfiguration.psm1 | 21 +- .../MSFT_TeamsUpgradePolicy.psm1 | 19 +- .../MSFT_TeamsUser/MSFT_TeamsUser.psm1 | 19 +- .../MSFT_TeamsVoiceRoute.psm1 | 4 +- .../MSFT_TeamsVoiceRoutingPolicy.psm1 | 4 +- Modules/Microsoft365DSC/Microsoft365DSC.psd1 | 9 +- .../Modules/M365DSCErrorHandler.psm1 | 16 + .../Modules/M365DSCReverse.psm1 | 973 +++++++++--------- 145 files changed, 1464 insertions(+), 950 deletions(-) create mode 100644 Modules/Microsoft365DSC/Modules/M365DSCErrorHandler.psm1 diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 index a91aa2379d..611153d37a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 @@ -646,6 +646,8 @@ function Export-TargetResource } $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/MSFT_AADConditionalAccessPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/MSFT_AADConditionalAccessPolicy.psm1 index 621d9c3fb4..00f9e96afb 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/MSFT_AADConditionalAccessPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/MSFT_AADConditionalAccessPolicy.psm1 @@ -1825,11 +1825,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroupsNamingPolicy/MSFT_AADGroupsNamingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroupsNamingPolicy/MSFT_AADGroupsNamingPolicy.psm1 index 3d1c8fce6e..9ba8f3468d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroupsNamingPolicy/MSFT_AADGroupsNamingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroupsNamingPolicy/MSFT_AADGroupsNamingPolicy.psm1 @@ -310,12 +310,17 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock } + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName + Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroupsSettings/MSFT_AADGroupsSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroupsSettings/MSFT_AADGroupsSettings.psm1 index c64bc0ae36..f6fabb25ab 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroupsSettings/MSFT_AADGroupsSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroupsSettings/MSFT_AADGroupsSettings.psm1 @@ -77,7 +77,7 @@ function Get-TargetResource $nullReturn.Ensure = "Absent" try { - $Policy = Get-AzureADDirectorySetting | Where-Object -FilterScript {$_.DisplayName -eq "Group.Unified"} + $Policy = Get-AzureADDirectorySetting | Where-Object -FilterScript { $_.DisplayName -eq "Group.Unified" } if ($null -eq $Policy) { @@ -93,19 +93,19 @@ function Get-TargetResource $AllowedGroupName = $groupObject.DisplayName } $result = @{ - IsSingleInstance = 'Yes' - EnableGroupCreation = [Boolean]::Parse($Policy["EnableGroupCreation"]) - AllowGuestsToBeGroupOwner = [Boolean]::Parse($Policy["AllowGuestsToBeGroupOwner"]) - AllowGuestsToAccessGroups = [Boolean]::Parse($Policy["AllowGuestsToAccessGroups"]) - GuestUsageGuidelinesUrl = $Policy["GuestUsageGuidelinesUrl"] - GroupCreationAllowedGroupName = $AllowedGroupName - AllowToAddGuests = [Boolean]::Parse($Policy["AllowToAddGuests"]) - UsageGuidelinesUrl = $Policy["UsageGuidelinesUrl"] - Ensure = "Present" - GlobalAdminAccount = $GlobalAdminAccount - ApplicationId = $ApplicationId - TenantId = $TenantId - CertificateThumbprint = $CertificateThumbprint + IsSingleInstance = 'Yes' + EnableGroupCreation = [Boolean]::Parse($Policy["EnableGroupCreation"]) + AllowGuestsToBeGroupOwner = [Boolean]::Parse($Policy["AllowGuestsToBeGroupOwner"]) + AllowGuestsToAccessGroups = [Boolean]::Parse($Policy["AllowGuestsToAccessGroups"]) + GuestUsageGuidelinesUrl = $Policy["GuestUsageGuidelinesUrl"] + GroupCreationAllowedGroupName = $AllowedGroupName + AllowToAddGuests = [Boolean]::Parse($Policy["AllowToAddGuests"]) + UsageGuidelinesUrl = $Policy["UsageGuidelinesUrl"] + Ensure = "Present" + GlobalAdminAccount = $GlobalAdminAccount + ApplicationId = $ApplicationId + TenantId = $TenantId + CertificateThumbprint = $CertificateThumbprint } Write-Verbose -Message "Get-TargetResource Result: `n $(Convert-M365DscHashtableToString -Hashtable $result)" @@ -220,7 +220,7 @@ function Set-TargetResource $needToUpdate = $true } - $Policy = Get-AzureADDirectorySetting | Where-Object -FilterScript {$_.DisplayName -eq "Group.Unified"} + $Policy = Get-AzureADDirectorySetting | Where-Object -FilterScript { $_.DisplayName -eq "Group.Unified" } if (($Ensure -eq 'Present' -and $currentPolicy.Ensure -eq 'Present') -or $needToUpdate) { @@ -230,13 +230,13 @@ function Set-TargetResource { $groupId = $groupObject.ObjectId } - $Policy["EnableGroupCreation"] = [System.Boolean]$EnableGroupCreation - $Policy["AllowGuestsToBeGroupOwner"] = [System.Boolean]$AllowGuestsToBeGroupOwner - $Policy["AllowGuestsToAccessGroups"] = [System.Boolean]$AllowGuestsToAccessGroups - $Policy["GuestUsageGuidelinesUrl"] = $GuestUsageGuidelinesUrl - $Policy["GroupCreationAllowedGroupId"] = $groupId - $Policy["AllowToAddGuests"] = [System.Boolean]$AllowToAddGuests - $Policy["UsageGuidelinesUrl"] = $UsageGuidelinesUrl + $Policy["EnableGroupCreation"] = [System.Boolean]$EnableGroupCreation + $Policy["AllowGuestsToBeGroupOwner"] = [System.Boolean]$AllowGuestsToBeGroupOwner + $Policy["AllowGuestsToAccessGroups"] = [System.Boolean]$AllowGuestsToAccessGroups + $Policy["GuestUsageGuidelinesUrl"] = $GuestUsageGuidelinesUrl + $Policy["GroupCreationAllowedGroupId"] = $groupId + $Policy["AllowToAddGuests"] = [System.Boolean]$AllowToAddGuests + $Policy["UsageGuidelinesUrl"] = $UsageGuidelinesUrl Set-AzureADDirectorySetting -Id $Policy.id -DirectorySetting $Policy } @@ -375,21 +375,24 @@ function Export-TargetResource { $ConnectionMode = New-M365DSCConnection -Platform 'AzureAD' -InboundParameters $PSBoundParameters $Params = @{ - ApplicationId = $ApplicationId - TenantId = $TenantId - CertificateThumbprint = $CertificateThumbprint - IsSingleInstance = 'Yes' - GlobalAdminAccount = $GlobalAdminAccount + ApplicationId = $ApplicationId + TenantId = $TenantId + CertificateThumbprint = $CertificateThumbprint + IsSingleInstance = 'Yes' + GlobalAdminAccount = $GlobalAdminAccount } $dscContent = '' $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 index bf8444d7bd..4b4caee65c 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 @@ -481,11 +481,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName + Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroupLifecyclePolicy/MSFT_AADMSGroupLifecyclePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroupLifecyclePolicy/MSFT_AADMSGroupLifecyclePolicy.psm1 index e57df94719..bbd3eb7d7c 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroupLifecyclePolicy/MSFT_AADMSGroupLifecyclePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroupLifecyclePolicy/MSFT_AADMSGroupLifecyclePolicy.psm1 @@ -414,12 +414,17 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock } + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName + Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.psm1 index 68596e2a04..4720213b71 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.psm1 @@ -370,11 +370,15 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName + Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADPolicy/MSFT_AADPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADPolicy/MSFT_AADPolicy.psm1 index d35fd9f55b..f280c320ff 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADPolicy/MSFT_AADPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADPolicy/MSFT_AADPolicy.psm1 @@ -88,7 +88,7 @@ function Get-TargetResource catch { Write-Verbose -Message $_ - ADD-M365DSCEvent -Message $_ -EntryType 'Error' ` + Add-M365DSCEvent -Message $_ -EntryType 'Error' ` -EventID 1 -Source $($MyInvocation.MyCommand.Source) } } @@ -362,11 +362,15 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName + Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/MSFT_AADRoleDefinition.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/MSFT_AADRoleDefinition.psm1 index d788d330bd..77acc0a2fc 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/MSFT_AADRoleDefinition.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/MSFT_AADRoleDefinition.psm1 @@ -390,11 +390,16 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName + Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADServicePrincipal/MSFT_AADServicePrincipal.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADServicePrincipal/MSFT_AADServicePrincipal.psm1 index 572dfd1d97..29ee5710d1 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADServicePrincipal/MSFT_AADServicePrincipal.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADServicePrincipal/MSFT_AADServicePrincipal.psm1 @@ -484,11 +484,15 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName + Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADTenantDetails/MSFT_AADTenantDetails.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADTenantDetails/MSFT_AADTenantDetails.psm1 index 36c32a26e3..feaa27a5dc 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADTenantDetails/MSFT_AADTenantDetails.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADTenantDetails/MSFT_AADTenantDetails.psm1 @@ -83,7 +83,7 @@ function Get-TargetResource TenantId = $TenantId CertificateThumbprint = $CertificateThumbprint } - Write-Verbose -Message "Get-TargetResource Result: `n $(Convert-M365DSCHashTabletoString -Hashtable $result)" + Write-Verbose -Message "Get-TargetResource Result: `n $(Convert-M365DscHashtableToString -Hashtable $result)" return $result } } @@ -320,10 +320,15 @@ function Export-TargetResource } $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName -ConnectionMode $ConnectionMode ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName + Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAcceptedDomain/MSFT_EXOAcceptedDomain.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAcceptedDomain/MSFT_EXOAcceptedDomain.psm1 index 34934a69e6..b3bb490214 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAcceptedDomain/MSFT_EXOAcceptedDomain.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAcceptedDomain/MSFT_EXOAcceptedDomain.psm1 @@ -380,11 +380,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOActiveSyncDeviceAccessRule/MSFT_EXOActiveSyncDeviceAccessRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOActiveSyncDeviceAccessRule/MSFT_EXOActiveSyncDeviceAccessRule.psm1 index 2034c43713..1f7ed1cbfe 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOActiveSyncDeviceAccessRule/MSFT_EXOActiveSyncDeviceAccessRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOActiveSyncDeviceAccessRule/MSFT_EXOActiveSyncDeviceAccessRule.psm1 @@ -238,7 +238,6 @@ function Set-TargetResource { Write-Verbose -Message "Active Sync Device Access Rule '$($Identity)' already exists, but needs updating." Write-Verbose -Message "Setting Active Sync Device Access Rule $($Identity) with values: $(Convert-M365DscHashtableToString -Hashtable $SetActiveSyncDeviceAccessRuleParams)" - $SetActiveSyncDeviceAccessRuleParams.Identity = Get-ActiveSyncDeviceAccessRule | Where {$_.AccessLevel -eq $NewActiveSyncDeviceAccessRuleParams.AccessLevel -and $_.Characteristic -eq $NewActiveSyncDeviceAccessRuleParams.Characteristic -and $_.QueryString -eq $NewActiveSyncDeviceAccessRuleParams.QueryString} | SELECT -ExpandProperty "Identity" Set-ActiveSyncDeviceAccessRule @SetActiveSyncDeviceAccessRuleParams } } @@ -407,11 +406,15 @@ function Export-TargetResource $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` - -ConnectionMode $ConnectionMode ` + currentDSCBlocktonMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount - Write-Host $Global:M365DSCEmojiGreenCheckMark + Write-Host $Global:M365DSCEmojiGreenCheckMa + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileNamerk $i++ } return $dscContent @@ -444,3 +447,4 @@ function Export-TargetResource Export-ModuleMember -Function *-TargetResource + diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressBookPolicy/MSFT_EXOAddressBookPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressBookPolicy/MSFT_EXOAddressBookPolicy.psm1 index fb342503fb..8be42d78db 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressBookPolicy/MSFT_EXOAddressBookPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressBookPolicy/MSFT_EXOAddressBookPolicy.psm1 @@ -399,11 +399,11 @@ function Export-TargetResource } else { - Write-Host "`r`n" -NoNewLine + Write-Host "`r`n" -NoNewline } foreach ($AddressBookPolicy in $AllAddressBookPolicies) { - Write-Host " |---[$i/$($AllAddressBookPolicies.Count)] $($AddressBookPolicy.Name)" -NoNewLine + Write-Host " |---[$i/$($AllAddressBookPolicies.Count)] $($AddressBookPolicy.Name)" -NoNewline $Params = @{ Name = $AddressBookPolicy.Name @@ -417,12 +417,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressList/MSFT_EXOAddressList.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressList/MSFT_EXOAddressList.psm1 index c5a0dff89d..900226a2d6 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressList/MSFT_EXOAddressList.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressList/MSFT_EXOAddressList.psm1 @@ -710,11 +710,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i ++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishPolicy/MSFT_EXOAntiPhishPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishPolicy/MSFT_EXOAntiPhishPolicy.psm1 index e2f4f20e41..c50be688c2 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishPolicy/MSFT_EXOAntiPhishPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishPolicy/MSFT_EXOAntiPhishPolicy.psm1 @@ -723,11 +723,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishRule/MSFT_EXOAntiPhishRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishRule/MSFT_EXOAntiPhishRule.psm1 index 58424d6422..f1a66c2f18 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishRule/MSFT_EXOAntiPhishRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishRule/MSFT_EXOAntiPhishRule.psm1 @@ -545,11 +545,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOApplicationAccessPolicy/MSFT_EXOApplicationAccessPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOApplicationAccessPolicy/MSFT_EXOApplicationAccessPolicy.psm1 index 4aeb093e9a..b4f8879d6f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOApplicationAccessPolicy/MSFT_EXOApplicationAccessPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOApplicationAccessPolicy/MSFT_EXOApplicationAccessPolicy.psm1 @@ -428,12 +428,12 @@ function Export-TargetResource } else { - Write-Host "`r`n" -NoNewLine + Write-Host "`r`n" -NoNewline } $i = 1 foreach ($ApplicationAccessPolicy in $AllApplicationAccessPolicies) { - Write-Host " |---[$i/$($AllApplicationAccessPolicies.Count)] $($ApplicationAccessPolicy.Identity)" -NoNewLine + Write-Host " |---[$i/$($AllApplicationAccessPolicies.Count)] $($ApplicationAccessPolicy.Identity)" -NoNewline $Params = @{ Identity = $ApplicationAccessPolicy.Identity @@ -447,11 +447,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAtpPolicyForO365/MSFT_EXOAtpPolicyForO365.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAtpPolicyForO365/MSFT_EXOAtpPolicyForO365.psm1 index 484d77c51c..a0c10cba05 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAtpPolicyForO365/MSFT_EXOAtpPolicyForO365.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAtpPolicyForO365/MSFT_EXOAtpPolicyForO365.psm1 @@ -438,11 +438,16 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 index c36aa9a19c..6b20c266df 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 @@ -475,11 +475,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityConfig/MSFT_EXOAvailabilityConfig.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityConfig/MSFT_EXOAvailabilityConfig.psm1 index 549a0e1930..6f6f29b6f3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityConfig/MSFT_EXOAvailabilityConfig.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityConfig/MSFT_EXOAvailabilityConfig.psm1 @@ -350,12 +350,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOCASMailboxPlan/MSFT_EXOCASMailboxPlan.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOCASMailboxPlan/MSFT_EXOCASMailboxPlan.psm1 index be3c71699c..a2603787de 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOCASMailboxPlan/MSFT_EXOCASMailboxPlan.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOCASMailboxPlan/MSFT_EXOCASMailboxPlan.psm1 @@ -404,11 +404,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOClientAccessRule/MSFT_EXOClientAccessRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOClientAccessRule/MSFT_EXOClientAccessRule.psm1 index bd4a10beca..b73c1ec5c5 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOClientAccessRule/MSFT_EXOClientAccessRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOClientAccessRule/MSFT_EXOClientAccessRule.psm1 @@ -559,11 +559,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXODkimSigningConfig/MSFT_EXODkimSigningConfig.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXODkimSigningConfig/MSFT_EXODkimSigningConfig.psm1 index 988ab09a3f..175c66bfcf 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXODkimSigningConfig/MSFT_EXODkimSigningConfig.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXODkimSigningConfig/MSFT_EXODkimSigningConfig.psm1 @@ -416,11 +416,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOEmailAddressPolicy/MSFT_EXOEmailAddressPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOEmailAddressPolicy/MSFT_EXOEmailAddressPolicy.psm1 index f4f2a8bb35..03e8357009 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOEmailAddressPolicy/MSFT_EXOEmailAddressPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOEmailAddressPolicy/MSFT_EXOEmailAddressPolicy.psm1 @@ -443,11 +443,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOGlobalAddressList/MSFT_EXOGlobalAddressList.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOGlobalAddressList/MSFT_EXOGlobalAddressList.psm1 index 0ecec48b9d..918c52c849 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOGlobalAddressList/MSFT_EXOGlobalAddressList.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOGlobalAddressList/MSFT_EXOGlobalAddressList.psm1 @@ -705,11 +705,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedConnectionFilterPolicy/MSFT_EXOHostedConnectionFilterPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedConnectionFilterPolicy/MSFT_EXOHostedConnectionFilterPolicy.psm1 index c106a2e49a..7046ec72a8 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedConnectionFilterPolicy/MSFT_EXOHostedConnectionFilterPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedConnectionFilterPolicy/MSFT_EXOHostedConnectionFilterPolicy.psm1 @@ -459,11 +459,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 index 03668a915e..f39904fa96 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 @@ -1067,11 +1067,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterRule/MSFT_EXOHostedContentFilterRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterRule/MSFT_EXOHostedContentFilterRule.psm1 index caa591ed22..4cd9551a0f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterRule/MSFT_EXOHostedContentFilterRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterRule/MSFT_EXOHostedContentFilterRule.psm1 @@ -518,11 +518,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedOutboundSpamFilterPolicy/MSFT_EXOHostedOutboundSpamFilterPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedOutboundSpamFilterPolicy/MSFT_EXOHostedOutboundSpamFilterPolicy.psm1 index 0525959b92..27e580bed4 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedOutboundSpamFilterPolicy/MSFT_EXOHostedOutboundSpamFilterPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedOutboundSpamFilterPolicy/MSFT_EXOHostedOutboundSpamFilterPolicy.psm1 @@ -399,11 +399,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOInboundConnector/MSFT_EXOInboundConnector.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOInboundConnector/MSFT_EXOInboundConnector.psm1 index 133c521341..7cf6f1858d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOInboundConnector/MSFT_EXOInboundConnector.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOInboundConnector/MSFT_EXOInboundConnector.psm1 @@ -531,11 +531,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOIntraOrganizationConnector/MSFT_EXOIntraOrganizationConnector.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOIntraOrganizationConnector/MSFT_EXOIntraOrganizationConnector.psm1 index e04dcf2de3..3758acd9bf 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOIntraOrganizationConnector/MSFT_EXOIntraOrganizationConnector.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOIntraOrganizationConnector/MSFT_EXOIntraOrganizationConnector.psm1 @@ -390,11 +390,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailTips/MSFT_EXOMailTips.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailTips/MSFT_EXOMailTips.psm1 index 1fec56ad63..8b473706fc 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailTips/MSFT_EXOMailTips.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailTips/MSFT_EXOMailTips.psm1 @@ -410,11 +410,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailboxSettings/MSFT_EXOMailboxSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailboxSettings/MSFT_EXOMailboxSettings.psm1 index 9c7613b1ce..42fc29933d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailboxSettings/MSFT_EXOMailboxSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailboxSettings/MSFT_EXOMailboxSettings.psm1 @@ -318,12 +318,12 @@ function Export-TargetResource } else { - Write-Host "`r`n"-NoNewLine + Write-Host "`r`n"-NoNewline } $dscContent = '' foreach ($mailbox in $mailboxes) { - Write-Host " |---[$i/$($mailboxes.Length)] $($mailbox.Name)" -NoNewLine + Write-Host " |---[$i/$($mailboxes.Length)] $($mailbox.Name)" -NoNewline $mailboxName = $mailbox.Name if (![System.String]::IsNullOrEmpty($mailboxName)) { @@ -342,11 +342,14 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } } Write-Host $Global:M365DSCEmojiGreenCheckMark diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.psm1 index deff571a85..3e5dd2ff6b 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.psm1 @@ -636,11 +636,14 @@ function Export-TargetResource } $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 index e714471e19..333a7c9dc0 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 @@ -483,11 +483,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 index d6254d63ae..b951e80216 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 @@ -386,11 +386,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMobileDeviceMailboxPolicy/MSFT_EXOMobileDeviceMailboxPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMobileDeviceMailboxPolicy/MSFT_EXOMobileDeviceMailboxPolicy.psm1 index b6d7ea4b48..6926e3a7c1 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMobileDeviceMailboxPolicy/MSFT_EXOMobileDeviceMailboxPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMobileDeviceMailboxPolicy/MSFT_EXOMobileDeviceMailboxPolicy.psm1 @@ -1139,11 +1139,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOfflineAddressBook/MSFT_EXOOfflineAddressBook.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOfflineAddressBook/MSFT_EXOOfflineAddressBook.psm1 index 87a85635be..7dd06a92b8 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOfflineAddressBook/MSFT_EXOOfflineAddressBook.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOfflineAddressBook/MSFT_EXOOfflineAddressBook.psm1 @@ -219,11 +219,11 @@ function Set-TargetResource -InboundParameters $PSBoundParameters $NewOfflineAddressBookParams = @{ - Name = $Name - AddressLists = $AddressLists - DiffRetentionPeriod = $DiffRetentionPeriod - IsDefault = $IsDefault - Confirm = $false + Name = $Name + AddressLists = $AddressLists + DiffRetentionPeriod = $DiffRetentionPeriod + IsDefault = $IsDefault + Confirm = $false } $SetOfflineAddressBookParams = @{ @@ -432,11 +432,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOnPremisesOrganization/MSFT_EXOOnPremisesOrganization.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOnPremisesOrganization/MSFT_EXOOnPremisesOrganization.psm1 index 3c44c65d51..d1d6b290ba 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOnPremisesOrganization/MSFT_EXOOnPremisesOrganization.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOnPremisesOrganization/MSFT_EXOOnPremisesOrganization.psm1 @@ -462,11 +462,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOrganizationConfig/MSFT_EXOOrganizationConfig.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOrganizationConfig/MSFT_EXOOrganizationConfig.psm1 index 88368c2b24..7545eb9600 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOrganizationConfig/MSFT_EXOOrganizationConfig.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOrganizationConfig/MSFT_EXOOrganizationConfig.psm1 @@ -1164,11 +1164,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOrganizationRelationship/MSFT_EXOOrganizationRelationship.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOrganizationRelationship/MSFT_EXOOrganizationRelationship.psm1 index 39069a89b0..f6c31453d2 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOrganizationRelationship/MSFT_EXOOrganizationRelationship.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOrganizationRelationship/MSFT_EXOOrganizationRelationship.psm1 @@ -657,11 +657,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOutboundConnector/MSFT_EXOOutboundConnector.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOutboundConnector/MSFT_EXOOutboundConnector.psm1 index 0ca2449015..11fbb6b93e 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOutboundConnector/MSFT_EXOOutboundConnector.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOutboundConnector/MSFT_EXOOutboundConnector.psm1 @@ -564,11 +564,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOwaMailboxPolicy/MSFT_EXOOwaMailboxPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOwaMailboxPolicy/MSFT_EXOOwaMailboxPolicy.psm1 index ad05fa7f50..8a90540837 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOwaMailboxPolicy/MSFT_EXOOwaMailboxPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOwaMailboxPolicy/MSFT_EXOOwaMailboxPolicy.psm1 @@ -1431,11 +1431,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPartnerApplication/MSFT_EXOPartnerApplication.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPartnerApplication/MSFT_EXOPartnerApplication.psm1 index cdbd0ff2af..27651d1067 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPartnerApplication/MSFT_EXOPartnerApplication.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPartnerApplication/MSFT_EXOPartnerApplication.psm1 @@ -436,11 +436,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPolicyTipConfig/MSFT_EXOPolicyTipConfig.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPolicyTipConfig/MSFT_EXOPolicyTipConfig.psm1 index 7d40ce2834..a290e79da1 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPolicyTipConfig/MSFT_EXOPolicyTipConfig.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPolicyTipConfig/MSFT_EXOPolicyTipConfig.psm1 @@ -381,11 +381,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXORemoteDomain/MSFT_EXORemoteDomain.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXORemoteDomain/MSFT_EXORemoteDomain.psm1 index 8b636566ef..6696ff4cad 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXORemoteDomain/MSFT_EXORemoteDomain.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXORemoteDomain/MSFT_EXORemoteDomain.psm1 @@ -652,11 +652,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXORoleAssignmentPolicy/MSFT_EXORoleAssignmentPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXORoleAssignmentPolicy/MSFT_EXORoleAssignmentPolicy.psm1 index cbd1c6a887..d3b147efeb 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXORoleAssignmentPolicy/MSFT_EXORoleAssignmentPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXORoleAssignmentPolicy/MSFT_EXORoleAssignmentPolicy.psm1 @@ -417,11 +417,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeAttachmentPolicy/MSFT_EXOSafeAttachmentPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeAttachmentPolicy/MSFT_EXOSafeAttachmentPolicy.psm1 index 051019dab2..4ab2c92cdc 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeAttachmentPolicy/MSFT_EXOSafeAttachmentPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeAttachmentPolicy/MSFT_EXOSafeAttachmentPolicy.psm1 @@ -432,11 +432,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeAttachmentRule/MSFT_EXOSafeAttachmentRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeAttachmentRule/MSFT_EXOSafeAttachmentRule.psm1 index 926751db18..4488ae05ac 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeAttachmentRule/MSFT_EXOSafeAttachmentRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeAttachmentRule/MSFT_EXOSafeAttachmentRule.psm1 @@ -497,11 +497,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksPolicy/MSFT_EXOSafeLinksPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksPolicy/MSFT_EXOSafeLinksPolicy.psm1 index a32e717956..4c9727b0c3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksPolicy/MSFT_EXOSafeLinksPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksPolicy/MSFT_EXOSafeLinksPolicy.psm1 @@ -479,11 +479,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksRule/MSFT_EXOSafeLinksRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksRule/MSFT_EXOSafeLinksRule.psm1 index e9855ef0ea..2a1cdf0eba 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksRule/MSFT_EXOSafeLinksRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksRule/MSFT_EXOSafeLinksRule.psm1 @@ -495,11 +495,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSharedMailbox/MSFT_EXOSharedMailbox.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSharedMailbox/MSFT_EXOSharedMailbox.psm1 index 5f3fe4234c..eace62da04 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSharedMailbox/MSFT_EXOSharedMailbox.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSharedMailbox/MSFT_EXOSharedMailbox.psm1 @@ -438,11 +438,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSharingPolicy/MSFT_EXOSharingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSharingPolicy/MSFT_EXOSharingPolicy.psm1 index 959fdcdbd3..51056a0198 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSharingPolicy/MSFT_EXOSharingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSharingPolicy/MSFT_EXOSharingPolicy.psm1 @@ -406,11 +406,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 index ac58948158..3dab3af3ff 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 @@ -2538,11 +2538,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppConfigurationPolicy/MSFT_IntuneAppConfigurationPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppConfigurationPolicy/MSFT_IntuneAppConfigurationPolicy.psm1 index 56ebf4e51f..dc43eaa8d2 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppConfigurationPolicy/MSFT_IntuneAppConfigurationPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppConfigurationPolicy/MSFT_IntuneAppConfigurationPolicy.psm1 @@ -226,7 +226,7 @@ function Export-TargetResource { [array]$configPolicies = Get-IntuneAppConfigurationPolicyTargeted -ErrorAction Stop $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewLine foreach ($configPolicy in $configPolicies) { @@ -238,15 +238,18 @@ function Export-TargetResource } $result = Get-TargetResource @params $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " IntuneAppConfigurationPolicy " + (New-GUID).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/MSFT_IntuneAppProtectionPolicyiOS.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/MSFT_IntuneAppProtectionPolicyiOS.psm1 index 9bad947dd8..74bb66ddc3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/MSFT_IntuneAppProtectionPolicyiOS.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/MSFT_IntuneAppProtectionPolicyiOS.psm1 @@ -581,7 +581,7 @@ function Export-TargetResource { [array]$policies = Get-IntuneAppProtectionPolicy -ErrorAction Stop | Where-Object -FilterScript { $_.'@odata.type' -eq '#microsoft.graph.iosManagedAppProtection' } $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -591,17 +591,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " IntuneAppProtectionPolicyiOS " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCategory/MSFT_IntuneDeviceCategory.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCategory/MSFT_IntuneDeviceCategory.psm1 index ce45835700..d48fcd86e9 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCategory/MSFT_IntuneDeviceCategory.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCategory/MSFT_IntuneDeviceCategory.psm1 @@ -226,7 +226,7 @@ function Export-TargetResource { [array]$categories = Get-IntuneDeviceCategory -ErrorAction Stop $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewLine foreach ($category in $categories) { @@ -236,17 +236,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " IntuneDeviceCategory " + (New-GUID).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyAndroid/MSFT_IntuneDeviceCompliancePolicyAndroid.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyAndroid/MSFT_IntuneDeviceCompliancePolicyAndroid.psm1 index 22b450f291..0ca20fca91 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyAndroid/MSFT_IntuneDeviceCompliancePolicyAndroid.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyAndroid/MSFT_IntuneDeviceCompliancePolicyAndroid.psm1 @@ -626,7 +626,7 @@ function Export-TargetResource -ErrorAction Stop | Where-Object ` -FilterScript { ($_.deviceCompliancePolicyODataType) -eq 'microsoft.graph.androidCompliancePolicy' } $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($configDeviceAndroidPolicy in $configDeviceAndroidPolicies) { @@ -636,17 +636,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " IntuneDeviceCompliancePolicyAndroid " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyAndroidWorkProfile/MSFT_IntuneDeviceCompliancePolicyAndroidWorkProfile.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyAndroidWorkProfile/MSFT_IntuneDeviceCompliancePolicyAndroidWorkProfile.psm1 index fc6b7ecba5..fb3dd16834 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyAndroidWorkProfile/MSFT_IntuneDeviceCompliancePolicyAndroidWorkProfile.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyAndroidWorkProfile/MSFT_IntuneDeviceCompliancePolicyAndroidWorkProfile.psm1 @@ -574,7 +574,7 @@ function Export-TargetResource -ErrorAction Stop | Where-Object ` -FilterScript { ($_.deviceCompliancePolicyODataType) -eq 'microsoft.graph.androidWorkProfileCompliancePolicy'} $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($configDeviceAndroidPolicy in $configDeviceAndroidPolicies) { @@ -584,17 +584,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " IntuneDeviceCompliancePolicyAndroidWorkProfile " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyiOs/MSFT_IntuneDeviceCompliancePolicyiOs.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyiOs/MSFT_IntuneDeviceCompliancePolicyiOs.psm1 index f10a1dea9b..91a89005f8 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyiOs/MSFT_IntuneDeviceCompliancePolicyiOs.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyiOs/MSFT_IntuneDeviceCompliancePolicyiOs.psm1 @@ -437,7 +437,7 @@ function Export-TargetResource -ErrorAction Stop | Where-Object ` -FilterScript { ($_.deviceCompliancePolicyODataType) -eq 'microsoft.graph.iosCompliancePolicy' } $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($configDeviceiOsPolicy in $configDeviceiOsPolicies) { @@ -447,17 +447,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " IntuneDeviceCompliancePolicyiOs " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyiOS/MSFT_IntuneDeviceConfigurationPolicyiOS.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyiOS/MSFT_IntuneDeviceConfigurationPolicyiOS.psm1 index 9df6d627cc..86cb0c51ac 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyiOS/MSFT_IntuneDeviceConfigurationPolicyiOS.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyiOS/MSFT_IntuneDeviceConfigurationPolicyiOS.psm1 @@ -1817,7 +1817,7 @@ function Export-TargetResource { [array]$policies = Get-IntuneDeviceConfigurationPolicy -ErrorAction Stop | Where-Object -FilterScript { $_.'@odata.type' -eq '#microsoft.graph.iosGeneralDeviceConfiguration' } $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -1827,17 +1827,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " IntuneDeviceConfigurationPolicyiOS " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentLimitRestriction/MSFT_IntuneDeviceEnrollmentLimitRestriction.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentLimitRestriction/MSFT_IntuneDeviceEnrollmentLimitRestriction.psm1 index 2f336f2bbb..8943d18ae8 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentLimitRestriction/MSFT_IntuneDeviceEnrollmentLimitRestriction.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentLimitRestriction/MSFT_IntuneDeviceEnrollmentLimitRestriction.psm1 @@ -234,7 +234,7 @@ function Export-TargetResource { [array]$configs = Get-IntuneDeviceEnrollmentConfiguration -ErrorAction Stop | Where-Object -FilterScript { $_.'@odata.type' -eq '#microsoft.graph.deviceEnrollmentLimitConfiguration' } $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($config in $configs) { @@ -244,17 +244,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " IntuneDeviceEnrollmentLimitRestriction " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentPlatformRestriction/MSFT_IntuneDeviceEnrollmentPlatformRestriction.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentPlatformRestriction/MSFT_IntuneDeviceEnrollmentPlatformRestriction.psm1 index 56621ae788..e6bd1bc74d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentPlatformRestriction/MSFT_IntuneDeviceEnrollmentPlatformRestriction.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentPlatformRestriction/MSFT_IntuneDeviceEnrollmentPlatformRestriction.psm1 @@ -477,7 +477,7 @@ function Export-TargetResource { [array]$configs = Get-IntuneDeviceEnrollmentConfiguration -ErrorAction Stop | Where-Object -FilterScript { $_.'@odata.type' -eq '#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration' } $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($config in $configs) { @@ -487,17 +487,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " IntuneDeviceEnrollmentPlatformRestriction " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_O365AdminAuditLogConfig/MSFT_O365AdminAuditLogConfig.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_O365AdminAuditLogConfig/MSFT_O365AdminAuditLogConfig.psm1 index e29e9f7b16..e76da1788c 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_O365AdminAuditLogConfig/MSFT_O365AdminAuditLogConfig.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_O365AdminAuditLogConfig/MSFT_O365AdminAuditLogConfig.psm1 @@ -174,7 +174,7 @@ function Set-TargetResource $ConnectionMode = New-M365DSCConnection -Platform 'ExchangeOnline' ` -InboundParameters $PSBoundParameters - + $OldErrorActionPreference = $ErrorActionPreference $ErrorActionPreference = "Continue" if ($UnifiedAuditLogIngestionEnabled -eq 'Enabled') @@ -345,11 +345,15 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_O365Group/MSFT_O365Group.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_O365Group/MSFT_O365Group.psm1 index e44989d086..9e64b9d1e1 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_O365Group/MSFT_O365Group.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_O365Group/MSFT_O365Group.psm1 @@ -528,11 +528,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgCustomizationSetting/MSFT_O365OrgCustomizationSetting.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgCustomizationSetting/MSFT_O365OrgCustomizationSetting.psm1 index b2cd0028a7..23062d0864 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgCustomizationSetting/MSFT_O365OrgCustomizationSetting.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgCustomizationSetting/MSFT_O365OrgCustomizationSetting.psm1 @@ -289,11 +289,15 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_O365User/MSFT_O365User.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_O365User/MSFT_O365User.psm1 index 2a8979c241..ef15d3f91f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_O365User/MSFT_O365User.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_O365User/MSFT_O365User.psm1 @@ -746,13 +746,16 @@ function Export-TargetResource $Results.Password = Resolve-Credentials -UserName "globaladmin" $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $currentContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount - $currentContent = Convert-DSCStringParamToVariable -DSCBlock $currentContent -ParameterName "Password" - $dscContent += $currentContent + $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentContent -ParameterName "Password" + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } } Write-Host $Global:M365DSCEmojiGreenCheckMark diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_ODSettings/MSFT_ODSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_ODSettings/MSFT_ODSettings.psm1 index 348816ff72..feb13e9cd6 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_ODSettings/MSFT_ODSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_ODSettings/MSFT_ODSettings.psm1 @@ -579,13 +579,18 @@ function Export-TargetResource $Results.Remove("GrooveBlockOption") | Out-Null } + $dscContent = '' $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_PPPowerAppsEnvironment/MSFT_PPPowerAppsEnvironment.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_PPPowerAppsEnvironment/MSFT_PPPowerAppsEnvironment.psm1 index bf5377623c..e5ab88608c 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_PPPowerAppsEnvironment/MSFT_PPPowerAppsEnvironment.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_PPPowerAppsEnvironment/MSFT_PPPowerAppsEnvironment.psm1 @@ -312,11 +312,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerBucket/MSFT_PlannerBucket.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerBucket/MSFT_PlannerBucket.psm1 index bff9ad2028..17fb8636b9 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerBucket/MSFT_PlannerBucket.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerBucket/MSFT_PlannerBucket.psm1 @@ -285,7 +285,7 @@ function Export-TargetResource $ConnectionMode = Connect-Graph -Scopes "Group.ReadWrite.All" $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($group in $groups) { @@ -311,12 +311,18 @@ function Export-TargetResource TenantId = $TenantId CertificateThumbprint = $CertificateThumbprint } - $result = Get-TargetResource @params - $content += " PlannerBucket " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += $currentDSCBlock - $content += " }`r`n" + $results = Get-TargetResource @params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $k++ } @@ -348,7 +354,7 @@ function Export-TargetResource } } } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerPlan/MSFT_PlannerPlan.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerPlan/MSFT_PlannerPlan.psm1 index 5ea29aeda7..b3412d439a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerPlan/MSFT_PlannerPlan.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerPlan/MSFT_PlannerPlan.psm1 @@ -342,7 +342,7 @@ function Export-TargetResource $ConnectionMode = Connect-Graph -Scopes "Group.ReadWrite.All" $i = 1 - $content = '' + $dscContent = '' foreach ($group in $groups) { Write-Host " [$i/$($groups.Length)] $($group.DisplayName) - {$($group.ObjectID)}" @@ -361,12 +361,18 @@ function Export-TargetResource CertificateThumbprint = $CertificateThumbprint } Write-Host " [$j/$($plans.Length)] $($plan.Title)" - $result = Get-TargetResource @params - $content += " PlannerPlan " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += $currentDSCBlock - $content += " }`r`n" + $results = Get-TargetResource @params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $j++ } $i++ @@ -395,7 +401,7 @@ function Export-TargetResource } } } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerTask/MSFT_PlannerTask.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerTask/MSFT_PlannerTask.psm1 index 9685885454..2a159622a3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerTask/MSFT_PlannerTask.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_PlannerTask/MSFT_PlannerTask.psm1 @@ -567,7 +567,7 @@ function Export-TargetResource [array]$groups = Get-AzureADGroup -All:$true $i = 1 - $content = '' + $dscContent = '' foreach ($group in $groups) { Write-Host " |---[$i/$($groups.Length)] $($group.DisplayName) - {$($group.ObjectID)}" @@ -632,25 +632,37 @@ function Export-TargetResource $result.Notes = $result.Notes.Replace('"', '``"') $result.Notes = $result.Notes.Replace("&", "``&") - $content += " PlannerTask " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock ` + $currentDSCBlock += " PlannerTask " + (New-Guid).ToString() + "`r`n" + $currentDSCBlock += " {`r`n" + $content = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot + $content = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock ` -ParameterName "GlobalAdminAccount" if ($result.Attachments.Length -gt 0) { - $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock ` + $content = Convert-DSCStringParamToVariable -DSCBlock $content ` -ParameterName "Attachments" ` -IsCIMArray $true } if ($result.Checklist.Length -gt 0) { - $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock ` + $content = Convert-DSCStringParamToVariable -DSCBlock $content ` -ParameterName "Checklist" ` -IsCIMArray $true } - $content += $currentDSCBlock - $content += " }`r`n" + $currentDSCBlock += $content + $currentDSCBlock += " }`r`n" + $dscContent += $currentDSCBlock + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $k++ Write-Host $Global:M365DSCEmojiGreenCheckmark } @@ -682,7 +694,7 @@ function Export-TargetResource } $i++ } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCAuditConfigurationPolicy/MSFT_SCAuditConfigurationPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCAuditConfigurationPolicy/MSFT_SCAuditConfigurationPolicy.psm1 index 82f73fdb57..4ba513e0a1 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCAuditConfigurationPolicy/MSFT_SCAuditConfigurationPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCAuditConfigurationPolicy/MSFT_SCAuditConfigurationPolicy.psm1 @@ -265,11 +265,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCCaseHoldPolicy/MSFT_SCCaseHoldPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCCaseHoldPolicy/MSFT_SCCaseHoldPolicy.psm1 index acd1aff594..eaca3afe49 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCCaseHoldPolicy/MSFT_SCCaseHoldPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCCaseHoldPolicy/MSFT_SCCaseHoldPolicy.psm1 @@ -395,11 +395,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $j++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCCaseHoldRule/MSFT_SCCaseHoldRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCCaseHoldRule/MSFT_SCCaseHoldRule.psm1 index a9d42aa095..3c104e6ce8 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCCaseHoldRule/MSFT_SCCaseHoldRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCCaseHoldRule/MSFT_SCCaseHoldRule.psm1 @@ -302,11 +302,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceCase/MSFT_SCComplianceCase.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceCase/MSFT_SCComplianceCase.psm1 index f7d15ab21b..0b17e9ec7a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceCase/MSFT_SCComplianceCase.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceCase/MSFT_SCComplianceCase.psm1 @@ -316,11 +316,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceSearch/MSFT_SCComplianceSearch.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceSearch/MSFT_SCComplianceSearch.psm1 index 8ff084e604..b3d630d07a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceSearch/MSFT_SCComplianceSearch.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceSearch/MSFT_SCComplianceSearch.psm1 @@ -451,11 +451,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceSearchAction/MSFT_SCComplianceSearchAction.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceSearchAction/MSFT_SCComplianceSearchAction.psm1 index 5f259119e7..fb44c5418d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceSearchAction/MSFT_SCComplianceSearchAction.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceSearchAction/MSFT_SCComplianceSearchAction.psm1 @@ -458,11 +458,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceTag/MSFT_SCComplianceTag.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceTag/MSFT_SCComplianceTag.psm1 index 89d699289b..12e7f916ff 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceTag/MSFT_SCComplianceTag.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceTag/MSFT_SCComplianceTag.psm1 @@ -455,6 +455,8 @@ function Export-TargetResource $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "FilePlanProperty" } $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCDLPCompliancePolicy/MSFT_SCDLPCompliancePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCDLPCompliancePolicy/MSFT_SCDLPCompliancePolicy.psm1 index 89f1da48a9..db6ab80c08 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCDLPCompliancePolicy/MSFT_SCDLPCompliancePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCDLPCompliancePolicy/MSFT_SCDLPCompliancePolicy.psm1 @@ -564,11 +564,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckmark } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCDLPComplianceRule/MSFT_SCDLPComplianceRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCDLPComplianceRule/MSFT_SCDLPComplianceRule.psm1 index e621976503..7af0bded46 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCDLPComplianceRule/MSFT_SCDLPComplianceRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCDLPComplianceRule/MSFT_SCDLPComplianceRule.psm1 @@ -811,6 +811,9 @@ function Export-TargetResource $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "ContentContainsSensitiveInformation" -IsCIMArray $IsCIMArray } $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCDeviceConditionalAccessPolicy/MSFT_SCDeviceConditionalAccessPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCDeviceConditionalAccessPolicy/MSFT_SCDeviceConditionalAccessPolicy.psm1 index 0e28e25da6..8445066581 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCDeviceConditionalAccessPolicy/MSFT_SCDeviceConditionalAccessPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCDeviceConditionalAccessPolicy/MSFT_SCDeviceConditionalAccessPolicy.psm1 @@ -272,11 +272,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCDeviceConfigurationPolicy/MSFT_SCDeviceConfigurationPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCDeviceConfigurationPolicy/MSFT_SCDeviceConfigurationPolicy.psm1 index 2e5d217d5d..7775f924fa 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCDeviceConfigurationPolicy/MSFT_SCDeviceConfigurationPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCDeviceConfigurationPolicy/MSFT_SCDeviceConfigurationPolicy.psm1 @@ -272,11 +272,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyAuthority/MSFT_SCFilePlanPropertyAuthority.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyAuthority/MSFT_SCFilePlanPropertyAuthority.psm1 index 59421881a0..5323d34b6f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyAuthority/MSFT_SCFilePlanPropertyAuthority.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyAuthority/MSFT_SCFilePlanPropertyAuthority.psm1 @@ -250,11 +250,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyCategory/MSFT_SCFilePlanPropertyCategory.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyCategory/MSFT_SCFilePlanPropertyCategory.psm1 index 04b705584b..fd14e63627 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyCategory/MSFT_SCFilePlanPropertyCategory.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyCategory/MSFT_SCFilePlanPropertyCategory.psm1 @@ -250,11 +250,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyCitation/MSFT_SCFilePlanPropertyCitation.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyCitation/MSFT_SCFilePlanPropertyCitation.psm1 index 10800c1d8e..2b0feb33d5 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyCitation/MSFT_SCFilePlanPropertyCitation.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyCitation/MSFT_SCFilePlanPropertyCitation.psm1 @@ -278,11 +278,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyDepartment/MSFT_SCFilePlanPropertyDepartment.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyDepartment/MSFT_SCFilePlanPropertyDepartment.psm1 index ddccaff4ea..d18db8cc8d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyDepartment/MSFT_SCFilePlanPropertyDepartment.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyDepartment/MSFT_SCFilePlanPropertyDepartment.psm1 @@ -251,11 +251,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyReferenceId/MSFT_SCFilePlanPropertyReferenceId.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyReferenceId/MSFT_SCFilePlanPropertyReferenceId.psm1 index 3811a9df3e..e75629409a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyReferenceId/MSFT_SCFilePlanPropertyReferenceId.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertyReferenceId/MSFT_SCFilePlanPropertyReferenceId.psm1 @@ -251,11 +251,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertySubCategory/MSFT_SCFilePlanPropertySubCategory.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertySubCategory/MSFT_SCFilePlanPropertySubCategory.psm1 index d0a9c4ef90..1e1ca40bac 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertySubCategory/MSFT_SCFilePlanPropertySubCategory.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCFilePlanPropertySubCategory/MSFT_SCFilePlanPropertySubCategory.psm1 @@ -278,11 +278,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCLabelPolicy/MSFT_SCLabelPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCLabelPolicy/MSFT_SCLabelPolicy.psm1 index 2cf5d1b17d..ac7c68a15d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCLabelPolicy/MSFT_SCLabelPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCLabelPolicy/MSFT_SCLabelPolicy.psm1 @@ -664,6 +664,8 @@ function Export-TargetResource Write-Host $Global:M365DSCEmojiGreenCheckMark $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ } } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionCompliancePolicy/MSFT_SCRetentionCompliancePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionCompliancePolicy/MSFT_SCRetentionCompliancePolicy.psm1 index bcb0726e10..32100d48dc 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionCompliancePolicy/MSFT_SCRetentionCompliancePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionCompliancePolicy/MSFT_SCRetentionCompliancePolicy.psm1 @@ -775,11 +775,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionComplianceRule/MSFT_SCRetentionComplianceRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionComplianceRule/MSFT_SCRetentionComplianceRule.psm1 index f95a82ad1e..71f47b07b4 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionComplianceRule/MSFT_SCRetentionComplianceRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionComplianceRule/MSFT_SCRetentionComplianceRule.psm1 @@ -372,11 +372,14 @@ function Export-TargetResource } $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionEventType/MSFT_SCRetentionEventType.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionEventType/MSFT_SCRetentionEventType.psm1 index 5a57d5cedf..ad3b7fa2d5 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionEventType/MSFT_SCRetentionEventType.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCRetentionEventType/MSFT_SCRetentionEventType.psm1 @@ -257,11 +257,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCSensitivityLabel/MSFT_SCSensitivityLabel.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCSensitivityLabel/MSFT_SCSensitivityLabel.psm1 index afee0a7b98..edb22e3936 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCSensitivityLabel/MSFT_SCSensitivityLabel.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCSensitivityLabel/MSFT_SCSensitivityLabel.psm1 @@ -967,6 +967,8 @@ function Export-TargetResource Write-Host $Global:M365DSCEmojiGreenCheckMark $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ } } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCSupervisoryReviewPolicy/MSFT_SCSupervisoryReviewPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCSupervisoryReviewPolicy/MSFT_SCSupervisoryReviewPolicy.psm1 index 80841a501a..1339c478a2 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCSupervisoryReviewPolicy/MSFT_SCSupervisoryReviewPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCSupervisoryReviewPolicy/MSFT_SCSupervisoryReviewPolicy.psm1 @@ -267,11 +267,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCSupervisoryReviewRule/MSFT_SCSupervisoryReviewRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCSupervisoryReviewRule/MSFT_SCSupervisoryReviewRule.psm1 index eb78585cae..58d6153a01 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCSupervisoryReviewRule/MSFT_SCSupervisoryReviewRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCSupervisoryReviewRule/MSFT_SCSupervisoryReviewRule.psm1 @@ -284,11 +284,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOAccessControlSettings/MSFT_SPOAccessControlSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOAccessControlSettings/MSFT_SPOAccessControlSettings.psm1 index c4ad7ffd03..184fd85268 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOAccessControlSettings/MSFT_SPOAccessControlSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOAccessControlSettings/MSFT_SPOAccessControlSettings.psm1 @@ -454,14 +454,18 @@ function Export-TargetResource GlobalAdminAccount = $GlobalAdminAccount } + $dscContent = '' $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOApp/MSFT_SPOApp.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOApp/MSFT_SPOApp.psm1 index 9244a71342..ad5f637695 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOApp/MSFT_SPOApp.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOApp/MSFT_SPOApp.psm1 @@ -377,11 +377,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } $i++ Write-Host $Global:M365DSCEmojiGreenCheckmark diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOBrowserIdleSignout/MSFT_SPOBrowserIdleSignout.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOBrowserIdleSignout/MSFT_SPOBrowserIdleSignout.psm1 index 60f1ac714f..f45a6b4b7f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOBrowserIdleSignout/MSFT_SPOBrowserIdleSignout.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOBrowserIdleSignout/MSFT_SPOBrowserIdleSignout.psm1 @@ -326,14 +326,18 @@ function Export-TargetResource GlobalAdminAccount = $GlobalAdminAccount } + $dscContent = '' $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckmark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOHomeSite/MSFT_SPOHomeSite.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOHomeSite/MSFT_SPOHomeSite.psm1 index 6cbfd4450d..c591b413ec 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOHomeSite/MSFT_SPOHomeSite.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOHomeSite/MSFT_SPOHomeSite.psm1 @@ -330,14 +330,18 @@ function Export-TargetResource CertificateThumbprint = $CertificateThumbprint GlobalAdminAccount = $GlobalAdminAccount } + $dscContent = '' $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOHubSite/MSFT_SPOHubSite.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOHubSite/MSFT_SPOHubSite.psm1 index 971858869b..6d96eca7b3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOHubSite/MSFT_SPOHubSite.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOHubSite/MSFT_SPOHubSite.psm1 @@ -619,21 +619,22 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $partialContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount # Make the Url parameterized - if ($partialContent.ToLower().Contains($organization.ToLower()) -or ` - $partialContent.ToLower().Contains($principal.ToLower())) + if ($currentDSCBlock.ToLower().Contains($organization.ToLower()) -or ` + $currentDSCBlock.ToLower().Contains($principal.ToLower())) { - $partialContent = $partialContent -ireplace [regex]::Escape('https://' + $principal + '.sharepoint.com/'), "https://`$(`$OrganizationName.Split('.')[0]).sharepoint.com/" - $partialContent = $partialContent -ireplace [regex]::Escape("@" + $organization), "@`$(`$OrganizationName)" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape('https://' + $principal + '.sharepoint.com/'), "https://`$(`$OrganizationName.Split('.')[0]).sharepoint.com/" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape("@" + $organization), "@`$(`$OrganizationName)" } - $dscContent += $partialContent - + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOOrgAssetsLibrary/MSFT_SPOOrgAssetsLibrary.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOOrgAssetsLibrary/MSFT_SPOOrgAssetsLibrary.psm1 index e0077025a0..7fad430b9c 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOOrgAssetsLibrary/MSFT_SPOOrgAssetsLibrary.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOOrgAssetsLibrary/MSFT_SPOOrgAssetsLibrary.psm1 @@ -449,11 +449,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOPropertyBag/MSFT_SPOPropertyBag.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOPropertyBag/MSFT_SPOPropertyBag.psm1 index 2310348a97..6d696d8458 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOPropertyBag/MSFT_SPOPropertyBag.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOPropertyBag/MSFT_SPOPropertyBag.psm1 @@ -463,11 +463,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName "SPOPropertyBag" ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName "SPOPropertyBag" ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } } catch diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSearchManagedProperty/MSFT_SPOSearchManagedProperty.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSearchManagedProperty/MSFT_SPOSearchManagedProperty.psm1 index 504db46791..b288b45051 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSearchManagedProperty/MSFT_SPOSearchManagedProperty.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSearchManagedProperty/MSFT_SPOSearchManagedProperty.psm1 @@ -817,7 +817,7 @@ function Export-TargetResource [OutputType([System.String])] param ( - [Parameter()] + [Parameter()] [System.Management.Automation.PSCredential] $GlobalAdminAccount, @@ -879,11 +879,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckmark } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSearchResultSource/MSFT_SPOSearchResultSource.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSearchResultSource/MSFT_SPOSearchResultSource.psm1 index ff522b063c..77592a0634 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSearchResultSource/MSFT_SPOSearchResultSource.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSearchResultSource/MSFT_SPOSearchResultSource.psm1 @@ -576,11 +576,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckmark } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 index cc59eb5740..668fd35c9b 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 @@ -678,11 +678,14 @@ function Export-TargetResource } $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckmark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.psm1 index e479647839..6df2b3b679 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.psm1 @@ -966,18 +966,20 @@ function Export-TargetResource $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $partialContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount - if ($partialContent.ToLower().Contains($organization.ToLower()) -or ` - $partialContent.ToLower().Contains($principal.ToLower())) + if ($currentDSCBlock.ToLower().Contains($organization.ToLower()) -or ` + $currentDSCBlock.ToLower().Contains($principal.ToLower())) { - $partialContent = $partialContent -ireplace [regex]::Escape('https://' + $principal + '.sharepoint.com/'), "https://`$(`$OrganizationName.Split('.')[0]).sharepoint.com/" - $partialContent = $partialContent -ireplace [regex]::Escape("@" + $organization), "@`$(`$OrganizationName)" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape('https://' + $principal + '.sharepoint.com/'), "https://`$(`$OrganizationName.Split('.')[0]).sharepoint.com/" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape("@" + $organization), "@`$(`$OrganizationName)" } - $dscContent += $partialContent + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark } catch diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteAuditSettings/MSFT_SPOSiteAuditSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteAuditSettings/MSFT_SPOSiteAuditSettings.psm1 index 8caf96bf54..3208e6b659 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteAuditSettings/MSFT_SPOSiteAuditSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteAuditSettings/MSFT_SPOSiteAuditSettings.psm1 @@ -328,19 +328,21 @@ function Export-TargetResource } $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $partialContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount # Make the Url parameterized - if ($partialContent.ToLower().Contains($organization.ToLower()) -or ` - $partialContent.ToLower().Contains($principal.ToLower())) + if ($currentDSCBlock.ToLower().Contains($currentDSCBlock.ToLower()) -or ` + $currentDSCBlock.ToLower().Contains($currentDSCBlock.ToLower())) { - $partialContent = $partialContent -ireplace [regex]::Escape('https://' + $principal + '.sharepoint.com/'), "https://`$(`$OrganizationName.Split('.')[0]).sharepoint.com/" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape('https://' + $principal + '.sharepoint.com/'), "https://`$(`$OrganizationName.Split('.')[0]).sharepoint.com/" } - $dscContent += $partialContent + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteDesign/MSFT_SPOSiteDesign.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteDesign/MSFT_SPOSiteDesign.psm1 index c38cf3b55e..7b93bde1d5 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteDesign/MSFT_SPOSiteDesign.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteDesign/MSFT_SPOSiteDesign.psm1 @@ -463,11 +463,15 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckmark } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteDesignRights/MSFT_SPOSiteDesignRights.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteDesignRights/MSFT_SPOSiteDesignRights.psm1 index c9e16e3db4..d4db5b3f50 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteDesignRights/MSFT_SPOSiteDesignRights.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteDesignRights/MSFT_SPOSiteDesignRights.psm1 @@ -399,11 +399,15 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } $Params = @{ @@ -421,11 +425,15 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } Write-Host $Global:M365DSCEmojiGreenCheckmark $i++ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteGroup/MSFT_SPOSiteGroup.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteGroup/MSFT_SPOSiteGroup.psm1 index 1be8e19a97..96c46f2f84 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteGroup/MSFT_SPOSiteGroup.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteGroup/MSFT_SPOSiteGroup.psm1 @@ -525,21 +525,24 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $partialContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount # Make the Url parameterized - if ($partialContent.ToLower().Contains($organization.ToLower()) -or ` - $partialContent.ToLower().Contains($principal.ToLower())) + if ($currentDSCBlock.ToLower().Contains($organization.ToLower()) -or ` + $currentDSCBlock.ToLower().Contains($principal.ToLower())) { - $partialContent = $partialContent -ireplace [regex]::Escape('https://' + $principal + '.sharepoint.com/'), "https://`$(`$OrganizationName.Split('.')[0]).sharepoint.com/" - $partialContent = $partialContent -ireplace [regex]::Escape('https://' + $principal + '-my.sharepoint.com/'), "https://`$(`$OrganizationName.Split('.')[0])-my.sharepoint.com/" - $partialContent = $partialContent -ireplace [regex]::Escape("@" + $organization), "@`$(`$OrganizationName)" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape('https://' + $principal + '.sharepoint.com/'), "https://`$(`$OrganizationName.Split('.')[0]).sharepoint.com/" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape('https://' + $principal + '-my.sharepoint.com/'), "https://`$(`$OrganizationName.Split('.')[0])-my.sharepoint.com/" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape("@" + $organization), "@`$(`$OrganizationName)" } - $dscContent += $partialContent + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } } catch diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteScript/MSFT_SPOSiteScript.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteScript/MSFT_SPOSiteScript.psm1 index e140eacc33..1921abf610 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteScript/MSFT_SPOSiteScript.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteScript/MSFT_SPOSiteScript.psm1 @@ -445,11 +445,14 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOStorageEntity/MSFT_SPOStorageEntity.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOStorageEntity/MSFT_SPOStorageEntity.psm1 index 4845ba283a..1e0476b431 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOStorageEntity/MSFT_SPOStorageEntity.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOStorageEntity/MSFT_SPOStorageEntity.psm1 @@ -429,20 +429,22 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $partialContent = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount # Make the Url parameterized - if ($partialContent.ToLower().Contains($organization.ToLower()) -or ` - $partialContent.ToLower().Contains($principal.ToLower())) + if ($currentDSCBlock.ToLower().Contains($organization.ToLower()) -or ` + $currentDSCBlock.ToLower().Contains($principal.ToLower())) { - $partialContent = $partialContent -ireplace [regex]::Escape('https://' + $principal + '.sharepoint.com'), "https://`$(`$OrganizationName.Split('.')[0]).sharepoint.com" - $partialContent = $partialContent -ireplace [regex]::Escape('https://' + $principal + '-admin.sharepoint.com'), "https://`$(`$OrganizationName.Split('.')[0])-admin.sharepoint.com" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape('https://' + $principal + '.sharepoint.com'), "https://`$(`$OrganizationName.Split('.')[0]).sharepoint.com" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape('https://' + $principal + '-admin.sharepoint.com'), "https://`$(`$OrganizationName.Split('.')[0])-admin.sharepoint.com" } - $dscContent += $partialContent + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckmark diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantCdnEnabled/MSFT_SPOTenantCdnEnabled.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantCdnEnabled/MSFT_SPOTenantCdnEnabled.psm1 index 0516899f55..2e1df0c34e 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantCdnEnabled/MSFT_SPOTenantCdnEnabled.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantCdnEnabled/MSFT_SPOTenantCdnEnabled.psm1 @@ -346,11 +346,14 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } $i++ Write-Host $Global:M365DSCEmojiGreenCheckmark diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantCdnPolicy/MSFT_SPOTenantCdnPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantCdnPolicy/MSFT_SPOTenantCdnPolicy.psm1 index b63111eb73..a6562e7c7a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantCdnPolicy/MSFT_SPOTenantCdnPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantCdnPolicy/MSFT_SPOTenantCdnPolicy.psm1 @@ -341,11 +341,14 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } Write-Host $Global:M365DSCEmojiGreenCheckmark return $dscContent diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantSettings/MSFT_SPOTenantSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantSettings/MSFT_SPOTenantSettings.psm1 index be0e38f18f..68b65c48e2 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantSettings/MSFT_SPOTenantSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantSettings/MSFT_SPOTenantSettings.psm1 @@ -568,11 +568,14 @@ function Export-TargetResource } $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckmark return $dscContent } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTheme/MSFT_SPOTheme.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTheme/MSFT_SPOTheme.psm1 index 8e83ac6388..32bed77905 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTheme/MSFT_SPOTheme.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTheme/MSFT_SPOTheme.psm1 @@ -373,17 +373,19 @@ function Export-TargetResource $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results $Results.Palette = ConvertTo-SPOThemePalettePropertyString $Results.Palette - $partialDSC = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount if ($null -ne $Results.Palette) { - $partialDSC = Convert-DSCStringParamToVariable -DSCBlock $partialDSC ` + $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock ` -ParameterName "Palette" } - $dscContent += $partialDSC + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOUserProfileProperty/MSFT_SPOUserProfileProperty.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOUserProfileProperty/MSFT_SPOUserProfileProperty.psm1 index f0f77b82d1..01055c0f1c 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOUserProfileProperty/MSFT_SPOUserProfileProperty.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOUserProfileProperty/MSFT_SPOUserProfileProperty.psm1 @@ -361,11 +361,14 @@ function Export-TargetResource $Results.Properties = ConvertTo-SPOUserProfilePropertyInstanceString -Properties $result.Properties $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } } } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsCallingPolicy/MSFT_TeamsCallingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsCallingPolicy/MSFT_TeamsCallingPolicy.psm1 index 8000363bee..e3bd26a88c 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsCallingPolicy/MSFT_TeamsCallingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsCallingPolicy/MSFT_TeamsCallingPolicy.psm1 @@ -456,7 +456,7 @@ function Export-TargetResource { $i = 1 [array]$policies = Get-CsTeamsCallingPolicy - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -466,17 +466,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " TeamsCallingPolicy " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark $i++ } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 index 15a417f14e..3a87fb0b81 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 @@ -350,7 +350,7 @@ function Export-TargetResource { $teams = Get-Team -ErrorAction Stop $j = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($team in $Teams) { @@ -391,20 +391,23 @@ function Export-TargetResource { $result.Remove("GlobalAdminAccount") } - $content += " TeamsChannel " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot + $currentDSCBlock += " TeamsChannel " + (New-Guid).ToString() + "`r`n" + $currentDSCBlock += " {`r`n" + $content = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot if ($ConnectionMode -eq 'Credential') { - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" + $currentDSCBlock += Convert-DSCStringParamToVariable -DSCBlock $content -ParameterName "GlobalAdminAccount" } - $content += " }`r`n" + $currentDSCBlock += " }`r`n" + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } $j++ } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelTab/MSFT_TeamsChannelTab.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelTab/MSFT_TeamsChannelTab.psm1 index b43a3b91a2..e0abbc38b6 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelTab/MSFT_TeamsChannelTab.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelTab/MSFT_TeamsChannelTab.psm1 @@ -528,10 +528,13 @@ function Export-TargetResource { $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } Write-Host $Global:M365DSCEmojiGreenCheckmark $k++ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelsPolicy/MSFT_TeamsChannelsPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelsPolicy/MSFT_TeamsChannelsPolicy.psm1 index b83bdb7360..85d7d11b7d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelsPolicy/MSFT_TeamsChannelsPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelsPolicy/MSFT_TeamsChannelsPolicy.psm1 @@ -267,7 +267,7 @@ function Export-TargetResource { $i = 1 [array]$policies = Get-CsTeamsChannelsPolicy -ErrorAction Stop - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -276,17 +276,21 @@ function Export-TargetResource Identity = $policy.Identity GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " TeamsChannelsPolicy " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsClientConfiguration/MSFT_TeamsClientConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsClientConfiguration/MSFT_TeamsClientConfiguration.psm1 index b134139fc7..4bd3156e68 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsClientConfiguration/MSFT_TeamsClientConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsClientConfiguration/MSFT_TeamsClientConfiguration.psm1 @@ -367,19 +367,24 @@ function Export-TargetResource try { + $dscContent = '' $params = @{ Identity = "Global" GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content = " TeamsClientConfiguration " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 index 52a977e225..1035d7c5bb 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 @@ -310,7 +310,7 @@ function Export-TargetResource { $i = 1 [array]$policies = Get-CsTeamsEmergencyCallRoutingPolicy -ErrorAction Stop - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -321,23 +321,26 @@ function Export-TargetResource } $result = Get-TargetResource @params $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " TeamsEmergencyCallRoutingPolicy " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" + $currentDSCBlock = " TeamsEmergencyCallRoutingPolicy " + (New-Guid).ToString() + "`r`n" + $currentDSCBlock += " {`r`n" if ($null -ne $result.EmergencyNumbers) { $result.EmergencyNumbers = ConvertTo-TeamsEmergencyNumbersString -Numbers $result.EmergencyNumbers } - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot + $content = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot if ($null -ne $result.EmergencyNumbers) { - $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "EmergencyNumbers" + $content = Convert-DSCStringParamToVariable -DSCBlock $content -ParameterName "EmergencyNumbers" } - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $currentDSCBlock += Convert-DSCStringParamToVariable -DSCBlock $content -ParameterName "GlobalAdminAccount" + $currentDSCBlock += " }`r`n" + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallingPolicy/MSFT_TeamsEmergencyCallingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallingPolicy/MSFT_TeamsEmergencyCallingPolicy.psm1 index 6ebdb10f5f..eea2100da5 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallingPolicy/MSFT_TeamsEmergencyCallingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallingPolicy/MSFT_TeamsEmergencyCallingPolicy.psm1 @@ -303,7 +303,7 @@ function Export-TargetResource $i = 1 [array]$policies = Get-CsTeamsEmergencyCallingPolicy -ErrorAction Stop - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -312,22 +312,21 @@ function Export-TargetResource Identity = $policy.Identity GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " TeamsEmergencyCallingPolicy " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $partialContent = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - if ($partialContent.ToLower().IndexOf($organization.ToLower()) -gt 0) - { - $partialContent = $partialContent -ireplace [regex]::Escape("@" + $organization), "@`$OrganizationName" - } - $content += $partialContent - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestCallingConfiguration/MSFT_TeamsGuestCallingConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestCallingConfiguration/MSFT_TeamsGuestCallingConfiguration.psm1 index af7a234229..709741df13 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestCallingConfiguration/MSFT_TeamsGuestCallingConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestCallingConfiguration/MSFT_TeamsGuestCallingConfiguration.psm1 @@ -184,20 +184,25 @@ function Export-TargetResource try { + $dscContent = '' $params = @{ Identity = "Global" AllowPrivateCalling = $true GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content = " TeamsGuestCallingConfiguration " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMeetingConfiguration/MSFT_TeamsGuestMeetingConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMeetingConfiguration/MSFT_TeamsGuestMeetingConfiguration.psm1 index edca049f00..b4d7c70664 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMeetingConfiguration/MSFT_TeamsGuestMeetingConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMeetingConfiguration/MSFT_TeamsGuestMeetingConfiguration.psm1 @@ -209,19 +209,24 @@ function Export-TargetResource try { + $dscContent = '' $params = @{ Identity = "Global" GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content = " TeamsGuestMeetingConfiguration " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMessagingConfiguration/MSFT_TeamsGuestMessagingConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMessagingConfiguration/MSFT_TeamsGuestMessagingConfiguration.psm1 index e748482c70..82f871441b 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMessagingConfiguration/MSFT_TeamsGuestMessagingConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMessagingConfiguration/MSFT_TeamsGuestMessagingConfiguration.psm1 @@ -288,19 +288,24 @@ function Export-TargetResource try { + $dscContent = '' $params = @{ Identity = "Global" GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content = " TeamsGuestMessagingConfiguration " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastConfiguration/MSFT_TeamsMeetingBroadcastConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastConfiguration/MSFT_TeamsMeetingBroadcastConfiguration.psm1 index d52b74dc90..5f0790607a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastConfiguration/MSFT_TeamsMeetingBroadcastConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastConfiguration/MSFT_TeamsMeetingBroadcastConfiguration.psm1 @@ -249,24 +249,29 @@ function Export-TargetResource try { + $dscContent = '' $params = @{ Identity = "Global" GlobalAdminAccount = $GlobalAdminAccount } Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SdnApiToken" -Value "**********"` -Description "API Token for the Teams SDN Provider for Meeting Broadcast" - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $result.SdnAPIToken = '$ConfigurationData.Settings.SdnApiToken' - $content = " TeamsMeetingBroadcastConfiguration " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $partial = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $partial = Convert-DSCStringParamToVariable -DSCBlock $partial -ParameterName "SdnApiToken" - $content += $partial - $content += " }`r`n" + $results = Get-TargetResource @params + $results.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" + $results.SdnAPIToken = '$ConfigurationData.Settings.SdnApiToken' + + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastPolicy/MSFT_TeamsMeetingBroadcastPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastPolicy/MSFT_TeamsMeetingBroadcastPolicy.psm1 index 6d7840ee47..62596df921 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastPolicy/MSFT_TeamsMeetingBroadcastPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastPolicy/MSFT_TeamsMeetingBroadcastPolicy.psm1 @@ -279,7 +279,7 @@ function Export-TargetResource [array]$policies = Get-CsTeamsMeetingBroadcastPolicy -ErrorAction Stop $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -288,18 +288,21 @@ function Export-TargetResource GlobalAdminAccount = $GlobalAdminAccount } Write-Host " |---[$i/$($policies.Length)] $($policy.Identity)" -NoNewline - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " TeamsMeetingBroadcastPolicy " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $partial = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += $partial - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingConfiguration/MSFT_TeamsMeetingConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingConfiguration/MSFT_TeamsMeetingConfiguration.psm1 index 839934c3b8..d853fe5122 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingConfiguration/MSFT_TeamsMeetingConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingConfiguration/MSFT_TeamsMeetingConfiguration.psm1 @@ -343,19 +343,24 @@ function Export-TargetResource try { + $dscContent = '' $params = @{ Identity = "Global" GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content = " TeamsMeetingConfiguration " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 index 9fbf5213a9..0f1113fff1 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 @@ -805,7 +805,7 @@ function Export-TargetResource { $i = 1 [array]$policies = Get-CsTeamsMeetingPolicy -ErrorAction Stop - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -814,17 +814,21 @@ function Export-TargetResource Identity = $policy.Identity GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " TeamsMeetingPolicy " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckmark $i++ } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMessagingPolicy/MSFT_TeamsMessagingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMessagingPolicy/MSFT_TeamsMessagingPolicy.psm1 index bb6c1a1520..eef660328c 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMessagingPolicy/MSFT_TeamsMessagingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMessagingPolicy/MSFT_TeamsMessagingPolicy.psm1 @@ -463,7 +463,7 @@ function Export-TargetResource { $i = 1 [array]$policies = Get-CsTeamsMessagingPolicy -ErrorAction Stop - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -482,17 +482,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " TeamsMessagingPolicy " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsPstnUsage/MSFT_TeamsPstnUsage.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsPstnUsage/MSFT_TeamsPstnUsage.psm1 index e2f3e5c040..74eb668a97 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsPstnUsage/MSFT_TeamsPstnUsage.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsPstnUsage/MSFT_TeamsPstnUsage.psm1 @@ -218,7 +218,7 @@ function Export-TargetResource { $i = 1 [array]$usages = Get-CsOnlinePstnUsage -ErrorAction Stop | Select-Object -ExpandProperty Usage - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($usage in $usages) { @@ -228,17 +228,21 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName 'globaladmin' - $content += " TeamsPstnUsage " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName 'GlobalAdminAccount' - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 index 515510fd89..cfa3a1758e 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 @@ -682,7 +682,7 @@ function Export-TargetResource $teams = Get-Team $i = 1 - $content = "" + $dscContent = "" Write-Host "`r`n" -NoNewline foreach ($team in $teams) { @@ -706,28 +706,30 @@ function Export-TargetResource { $result.Remove("Owner") } - $content += " TeamsTeam " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot + $currentDSCBlock = " TeamsTeam " + (New-Guid).ToString() + "`r`n" + $currentDSCBlock += " {`r`n" + $content = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot if ($ConnectionMode -eq 'Credential') { - $partialContent = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" + $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $content -ParameterName "GlobalAdminAccount" } else { - $partialContent = $currentDSCBlock + $currentDSCBlock = $content } - $partialContent += " }`r`n" - if ($partialContent.ToLower().Contains("@" + $organization.ToLower())) + $currentDSCBlock += " }`r`n" + if ($currentDSCBlock.ToLower().Contains("@" + $organization.ToLower())) { - $partialContent = $partialContent -ireplace [regex]::Escape("@" + $organization), "@`$OrganizationName" + $currentDSCBlock = $currentDSCBlock -ireplace [regex]::Escape("@" + $organization), "@`$OrganizationName" } - $content += $partialContent + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckmark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTenantDialPlan/MSFT_TeamsTenantDialPlan.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTenantDialPlan/MSFT_TeamsTenantDialPlan.psm1 index a3adec8c21..a441f1df7e 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTenantDialPlan/MSFT_TeamsTenantDialPlan.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTenantDialPlan/MSFT_TeamsTenantDialPlan.psm1 @@ -409,7 +409,7 @@ function Export-TargetResource { [array]$tenantDialPlans = Get-CsTenantDialPlan -ErrorAction Stop - $content = '' + $dscContent = '' $i = 1 Write-Host "`r`n" -NoNewline foreach ($plan in $tenantDialPlans) @@ -426,16 +426,19 @@ function Export-TargetResource { $result.NormalizationRules = Get-M365DSCNormalizationRulesAsString $result.NormalizationRules } - $content += " TeamsTenantDialPlan " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "NormalizationRules" - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $currentDSCBlock = " TeamsTenantDialPlan " + (New-Guid).ToString() + "`r`n" + $currentDSCBlock += " {`r`n" + $content = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot + $content = Convert-DSCStringParamToVariable -DSCBlock $content -ParameterName "NormalizationRules" + $currentDSCBlock += Convert-DSCStringParamToVariable -DSCBlock $content -ParameterName "GlobalAdminAccount" + $currentDSCBlock += " }`r`n" + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradeConfiguration/MSFT_TeamsUpgradeConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradeConfiguration/MSFT_TeamsUpgradeConfiguration.psm1 index 860aea7405..7b41584e14 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradeConfiguration/MSFT_TeamsUpgradeConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradeConfiguration/MSFT_TeamsUpgradeConfiguration.psm1 @@ -194,19 +194,24 @@ function Export-TargetResource try { + $dscContent = '' $params = @{ IsSingleInstance = 'Yes' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content = " TeamsUpgradeConfiguration " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 index 5cbbbf9a34..545a6a534d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 @@ -213,7 +213,7 @@ function Export-TargetResource { [array]$policies = Get-CsTeamsUpgradePolicy -ErrorAction Stop $i = 1 - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -224,20 +224,23 @@ function Export-TargetResource } $result = Get-TargetResource @params $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " TeamsUpgradePolicy " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $partialContent = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" + $currentDSCBlock += " TeamsUpgradePolicy " + (New-Guid).ToString() + "`r`n" + $currentDSCBlock += " {`r`n" + $currentDSCBlock2 = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot + $partialContent = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock2 -ParameterName "GlobalAdminAccount" if ($partialContent.ToLower().IndexOf($organization.ToLower()) -gt 0) { $partialContent = $partialContent -ireplace [regex]::Escape("@" + $organization), "@`$OrganizationName" } - $content += $partialContent - $content += " }`r`n" + $currentDSCBlock += $partialContent + $currentDSCBlock += " }`r`n" + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 index 2f6e7d83e6..fa13d2cca8 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 @@ -400,7 +400,7 @@ function Export-TargetResource $returnValue += Invoke-M365DSCCommand -Arguments $PSBoundParameters -InvokationPath $ScriptRoot -ScriptBlock { $WarningPreference = 'SilentlyContinue' $params = $args[0] - $content = "" + $dscContent = "" $j = 1 $ConnectionMode = New-M365DSCConnection -Platform 'MicrosoftTeams' -InboundParameters $PSBoundParameters @@ -460,23 +460,26 @@ function Export-TargetResource { $result.Remove("GlobalAdminAccount") } - $content += " TeamsUser " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $params.ScriptRoot + $currentDSCBlock = " TeamsUser " + (New-Guid).ToString() + "`r`n" + $currentDSCBlock += " {`r`n" + $content = Get-DSCBlock -Params $result -ModulePath $params.ScriptRoot if ($ConnectionMode -eq 'Credential') { - $partialContent = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" + $partialContent = Convert-DSCStringParamToVariable -DSCBlock $content -ParameterName "GlobalAdminAccount" } else { - $partialContent = $currentDSCBlock + $partialContent = $content } $partialContent += " }`r`n" if ($partialContent.ToLower().Contains($params.OrganizationName.ToLower())) { $partialContent = $partialContent -ireplace [regex]::Escape($params.OrganizationName), "`$OrganizationName" } - $content += $partialContent + $currentDSCBlock += $partialContent + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ } } @@ -488,7 +491,7 @@ function Export-TargetResource $j++ } } - return $content + return $dscContent } return $returnValue } -ArgumentList @($batch, $PSScriptRoot, $GlobalAdminAccount, $ApplicationId, $TenantId, $CertificateThumbprint, $organization) | Out-Null diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 index 76e35869c5..a89678f545 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 @@ -319,7 +319,7 @@ function Export-TargetResource { $i = 1 [array]$routes = Get-CsOnlineVoiceRoute -ErrorAction Stop - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($route in $routes) { @@ -339,7 +339,7 @@ function Export-TargetResource $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 index eed999f065..bb3177c4d3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 @@ -260,7 +260,7 @@ function Export-TargetResource { $i = 1 [array]$policies = Get-CsOnlineVoiceRoutingPolicy -ErrorAction Stop - $content = '' + $dscContent = '' Write-Host "`r`n" -NoNewline foreach ($policy in $policies) { @@ -280,7 +280,7 @@ function Export-TargetResource $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 index a594a93014..4dc8108a99 100644 --- a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 +++ b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 @@ -120,12 +120,13 @@ # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess NestedModules = @( 'modules\M365DSCAgent.psm1', - 'modules\M365DSCUtil.psm1', - 'modules\M365DSCReverseGUI.psm1', - 'modules\M365DSCReverse.psm1', + 'modules\M365DSCErrorHandler.psm1', 'modules\M365DSCLogEngine.psm1', - 'modules\M365DSCTelemetryEngine.psm1', + 'modules\M365DSCReverse.psm1', + 'modules\M365DSCReverseGUI.psm1', 'modules\M365DSCStubsUtility.psm1', + 'modules\M365DSCTelemetryEngine.psm1', + 'modules\M365DSCUtil.psm1', 'modules\M365DSCReport.psm1', 'modules\EncodingHelpers\M365DSCEmojis.psm1', 'modules\EncodingHelpers\M365DSCStringEncoding.psm1' diff --git a/Modules/Microsoft365DSC/Modules/M365DSCErrorHandler.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCErrorHandler.psm1 new file mode 100644 index 0000000000..cc414fac03 --- /dev/null +++ b/Modules/Microsoft365DSC/Modules/M365DSCErrorHandler.psm1 @@ -0,0 +1,16 @@ +function Save-M365DSCPartialExport +{ + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true)] + [System.String] + $Content, + + [Parameter(Mandatory = $true)] + [System.String] + $FileName + ) + + $tempPath = Join-Path $env:TEMP -ChildPath $FileName + $Content | Out-File $tempPath -Append:$true -Force +} diff --git a/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 index d5adda64eb..ff15299e72 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 @@ -80,597 +80,606 @@ function Start-M365DSCConfigurationExtract { Add-M365DSCEvent -Message $_ -Source "M365DSCReverse::Test-M365DSCNewVersionAvailable" } - - $M365DSCExportStartTime = [System.DateTime]::Now - $InformationPreference = "Continue" - $VerbosePreference = "SilentlyContinue" - $WarningPreference = "SilentlyContinue" - - if ($null -ne $Workloads) - { - $ComponentsToExtract = Get-M365DSCResourcesByWorkloads -Workloads $Workloads ` - -Mode $Mode - } - - if ($null -eq $ComponentsToExtract -or $ComponentsToExtract.Length -eq 0) - { - $ComponentsToExtractSpecified = $false - } - else - { - $ComponentsToExtractSpecified = $true - } - - $ComponentsToSkip = @() - if ($Mode -eq 'Default') - { - $ComponentsToSkip = $Global:FullComponents - } - elseif ($Mode -eq 'Lite') + try { - $ComponentsToSkip = $Global:DefaultComponents + $Global:FullComponents - } + $Global:PartialExportFileName = "$(New-Guid).partial.ps1" + $M365DSCExportStartTime = [System.DateTime]::Now + $InformationPreference = "Continue" + $VerbosePreference = "SilentlyContinue" + $WarningPreference = "SilentlyContinue" - # Check to validate that based on the received authentication parameters - # we are allowed to export the selected components. - $AuthMethods = @() - $controlCredentials = @() - if ($null -ne $GlobalAdminAccount) - { - $AuthMethods += "Credentials" - } - if (-not [System.String]::IsNullOrEmpty($CertificateThumbprint) -or ` - -not [System.String]::IsNullOrEmpty($CertificatePassword) -or ` - -not [System.String]::IsNullOrEmpty($CertificatePath) -or ` - -not [System.String]::IsNullOrEmpty($TenantId)) - { - $AuthMethods += "Certificate" - } - if (-not [System.String]::IsNullOrEmpty($ApplicationId)) - { - $AuthMethods += "Application" - } - $allSupportedResources = Get-M365DSCComponentsForAuthenticationType -AuthenticationMethod $AuthMethods + if ($null -ne $Workloads) + { + $ComponentsToExtract = Get-M365DSCResourcesByWorkloads -Workloads $Workloads ` + -Mode $Mode + } - # If some resources are not supported based on the Authentication parameters - # received, write a warning. - if ($ComponentsToExtract.Length -eq 0) - { - $allResourcesInModule = Get-M365DSCAllResources - $selectedItems = Compare-Object -ReferenceObject $allResourcesInModule ` - -DifferenceObject $ComponentsToSkip | Where-Object -FilterScript { $_.SideIndicator -eq '<=' } - $selectedResources = @() - foreach ($item in $selectedItems) + if ($null -eq $ComponentsToExtract -or $ComponentsToExtract.Length -eq 0) { - $selectedResources += $item.InputObject + $ComponentsToExtractSpecified = $false + } + else + { + $ComponentsToExtractSpecified = $true } - } - else - { - $selectedResources = $ComponentsToExtract - } - try - { - $compareResourcesResult = Compare-Object -ReferenceObject $allSupportedResources ` - -DifferenceObject $selectedResources | Where-Object -FilterScript { $_.SideIndicator -eq '=>' } - } - catch - { - Write-Verbose -Message $_ - } + $ComponentsToSkip = @() + if ($Mode -eq 'Default') + { + $ComponentsToSkip = $Global:FullComponents + } + elseif ($Mode -eq 'Lite') + { + $ComponentsToSkip = $Global:DefaultComponents + $Global:FullComponents + } - if ($null -ne $compareResourcesResult) - { - # The client is trying to extract act least one resource which is not supported - # using only the provided authentication parameters; - $resourcesNotSupported = @() - foreach ($resource in $compareResourcesResult) + # Check to validate that based on the received authentication parameters + # we are allowed to export the selected components. + $AuthMethods = @() + $controlCredentials = @() + if ($null -ne $GlobalAdminAccount) { - $resourcesNotSupported += $resource.InputObject + $AuthMethods += "Credentials" + } + if (-not [System.String]::IsNullOrEmpty($CertificateThumbprint) -or ` + -not [System.String]::IsNullOrEmpty($CertificatePassword) -or ` + -not [System.String]::IsNullOrEmpty($CertificatePath) -or ` + -not [System.String]::IsNullOrEmpty($TenantId)) + { + $AuthMethods += "Certificate" + } + if (-not [System.String]::IsNullOrEmpty($ApplicationId)) + { + $AuthMethods += "Application" + } + $allSupportedResources = Get-M365DSCComponentsForAuthenticationType -AuthenticationMethod $AuthMethods - # Skip resources that are not supported; - $ComponentsToSkip += $resource.InputObject + # If some resources are not supported based on the Authentication parameters + # received, write a warning. + if ($ComponentsToExtract.Length -eq 0) + { + $allResourcesInModule = Get-M365DSCAllResources + $selectedItems = Compare-Object -ReferenceObject $allResourcesInModule ` + -DifferenceObject $ComponentsToSkip | Where-Object -FilterScript { $_.SideIndicator -eq '<=' } + $selectedResources = @() + foreach ($item in $selectedItems) + { + $selectedResources += $item.InputObject + } + } + else + { + $selectedResources = $ComponentsToExtract } - Write-Host "[WARNING]" -NoNewline -ForegroundColor Yellow - Write-Host " Based on the provided Authentication parameters, the following resources cannot be extracted: " -ForegroundColor Gray - Write-Host "$resourcesNotSupported" -ForegroundColor Gray - } + try + { + $compareResourcesResult = Compare-Object -ReferenceObject $allSupportedResources ` + -DifferenceObject $selectedResources | Where-Object -FilterScript { $_.SideIndicator -eq '=>' } + } + catch + { + Write-Verbose -Message $_ + } - if (-not $PSBoundParameters.ContainsKey('Quiet')) - { - $unattendedCommand = "Export-M365DSCConfiguration -Quiet -ComponentsToExtract @(" - $Components = "" - foreach ($resource in $ComponentsToExtract) + if ($null -ne $compareResourcesResult) { - if ($resource -ne 'Credential' -and $resource -ne 'Application' -and ` - $resource -ne 'Certificate') + # The client is trying to extract act least one resource which is not supported + # using only the provided authentication parameters; + $resourcesNotSupported = @() + foreach ($resource in $compareResourcesResult) { - $Components += "'$resource'," + $resourcesNotSupported += $resource.InputObject + + # Skip resources that are not supported; + $ComponentsToSkip += $resource.InputObject } + + Write-Host "[WARNING]" -NoNewline -ForegroundColor Yellow + Write-Host " Based on the provided Authentication parameters, the following resources cannot be extracted: " -ForegroundColor Gray + Write-Host "$resourcesNotSupported" -ForegroundColor Gray } - if (-not [System.String]::IsNullOrEmpty($Components)) + + if (-not $PSBoundParameters.ContainsKey('Quiet')) { - $Components = $Components.Substring(0, $Components.Length - 1) + $unattendedCommand = "Export-M365DSCConfiguration -Quiet -ComponentsToExtract @(" + $Components = "" + foreach ($resource in $ComponentsToExtract) + { + if ($resource -ne 'Credential' -and $resource -ne 'Application' -and ` + $resource -ne 'Certificate') + { + $Components += "'$resource'," + } + } + if (-not [System.String]::IsNullOrEmpty($Components)) + { + $Components = $Components.Substring(0, $Components.Length - 1) + } + $unattendedCommand += $Components + ") -GlobalAdminAccount (Get-Credential)" + Write-Host "[INFO]" -NoNewline -ForegroundColor Cyan + Write-Host " You can perform an equivalent unattended Export operation by running the following command:" -ForegroundColor Gray + Write-Host $unattendedCommand -ForegroundColor Blue } - $unattendedCommand += $Components + ") -GlobalAdminAccount (Get-Credential)" - Write-Host "[INFO]" -NoNewline -ForegroundColor Cyan - Write-Host " You can perform an equivalent unattended Export operation by running the following command:" -ForegroundColor Gray - Write-Host $unattendedCommand -ForegroundColor Blue - } - # Get Tenant Info - $organization = "" - $principal = "" # Principal represents the "NetBios" name of the tenant (e.g. the M365DSC part of M365DSC.onmicrosoft.com) + # Get Tenant Info + $organization = "" + $principal = "" # Principal represents the "NetBios" name of the tenant (e.g. the M365DSC part of M365DSC.onmicrosoft.com) - if ($AuthMethods -Contains 'Application') - { - $ConnectionMode = 'ServicePrincipal' - $organization = Get-M365DSCTenantDomain -ApplicationId $ApplicationId ` - -TenantId $TenantId ` - -CertificateThumbprint $CertificateThumbprint - } - elseif ($AuthMethods -Contains 'Certificate') - { - $ConnectionMode = 'ServicePrincipal' - $organization = $TenantId - } - elseif ($AuthMethods -Contains 'Credentials') - { - $ConnectionMode = 'Credential' - if ($null -ne $GlobalAdminAccount -and $GlobalAdminAccount.UserName.Contains("@")) + if ($AuthMethods -Contains 'Application') { - $organization = $GlobalAdminAccount.UserName.Split("@")[1] + $ConnectionMode = 'ServicePrincipal' + $organization = Get-M365DSCTenantDomain -ApplicationId $ApplicationId ` + -TenantId $TenantId ` + -CertificateThumbprint $CertificateThumbprint } - } - if ($organization.IndexOf(".") -gt 0) - { - $principal = $organization.Split(".")[0] - } - $AzureAutomation = $false - [array] $version = Get-Module 'Microsoft365DSC' - $version = $version[0].Version - $DSCContent = "# Generated with Microsoft365DSC version $version`r`n" - $DSCContent += "# For additional information on how to use Microsoft365DSC, please visit https://aka.ms/M365DSC`r`n" - if ($ConnectionMode -eq 'Credential') - { - $DSCContent += "param (`r`n" - $DSCContent += " [parameter()]`r`n" - $DSCContent += " [System.Management.Automation.PSCredential]`r`n" - $DSCContent += " `$GlobalAdminAccount`r`n" - $DSCContent += ")`r`n`r`n" - } - else - { - if (-not [System.String]::IsNullOrEmpty($CertificatePassword)) + elseif ($AuthMethods -Contains 'Certificate') + { + $ConnectionMode = 'ServicePrincipal' + $organization = $TenantId + } + elseif ($AuthMethods -Contains 'Credentials') + { + $ConnectionMode = 'Credential' + if ($null -ne $GlobalAdminAccount -and $GlobalAdminAccount.UserName.Contains("@")) + { + $organization = $GlobalAdminAccount.UserName.Split("@")[1] + } + } + if ($organization.IndexOf(".") -gt 0) + { + $principal = $organization.Split(".")[0] + } + $AzureAutomation = $false + [array] $version = Get-Module 'Microsoft365DSC' + $version = $version[0].Version + $DSCContent = "# Generated with Microsoft365DSC version $version`r`n" + $DSCContent += "# For additional information on how to use Microsoft365DSC, please visit https://aka.ms/M365DSC`r`n" + if ($ConnectionMode -eq 'Credential') { $DSCContent += "param (`r`n" $DSCContent += " [parameter()]`r`n" $DSCContent += " [System.Management.Automation.PSCredential]`r`n" - $DSCContent += " `$CertificatePassword`r`n" + $DSCContent += " `$GlobalAdminAccount`r`n" $DSCContent += ")`r`n`r`n" } - } + else + { + if (-not [System.String]::IsNullOrEmpty($CertificatePassword)) + { + $DSCContent += "param (`r`n" + $DSCContent += " [parameter()]`r`n" + $DSCContent += " [System.Management.Automation.PSCredential]`r`n" + $DSCContent += " `$CertificatePassword`r`n" + $DSCContent += ")`r`n`r`n" + } + } - if (-not [System.String]::IsNullOrEmpty($FileName)) - { - $FileParts = $FileName.Split('.') + if (-not [System.String]::IsNullOrEmpty($FileName)) + { + $FileParts = $FileName.Split('.') + if ([System.String]::IsNullOrEmpty($ConfigurationName)) + { + $ConfigurationName = $FileName.Replace('.' + $FileParts[$FileParts.Length - 1], "") + } + } if ([System.String]::IsNullOrEmpty($ConfigurationName)) { - $ConfigurationName = $FileName.Replace('.' + $FileParts[$FileParts.Length - 1], "") + $ConfigurationName = 'M365TenantConfig' } - } - if ([System.String]::IsNullOrEmpty($ConfigurationName)) - { - $ConfigurationName = 'M365TenantConfig' - } - $DSCContent += "Configuration $ConfigurationName`r`n{`r`n" + $DSCContent += "Configuration $ConfigurationName`r`n{`r`n" - if ($ConnectionMode -eq 'Credential') - { - $DSCContent += " param (`r`n" - $DSCContent += " [parameter()]`r`n" - $DSCContent += " [System.Management.Automation.PSCredential]`r`n" - $DSCContent += " `$GlobalAdminAccount`r`n" - $DSCContent += " )`r`n`r`n" - $DSCContent += " if (`$null -eq `$GlobalAdminAccount)`r`n" - $DSCContent += " {`r`n" - $DSCContent += " <# Credentials #>`r`n" - $DSCContent += " }`r`n" - $DSCContent += " else`r`n" - $DSCContent += " {`r`n" - $DSCContent += " `$Credsglobaladmin = `$GlobalAdminAccount`r`n" - $DSCContent += " }`r`n`r`n" - $DSCContent += " `$OrganizationName = `$Credsglobaladmin.UserName.Split('@')[1]`r`n" - } - else - { - if (-not [System.String]::IsNullOrEmpty($CertificatePassword)) + if ($ConnectionMode -eq 'Credential') { $DSCContent += " param (`r`n" $DSCContent += " [parameter()]`r`n" $DSCContent += " [System.Management.Automation.PSCredential]`r`n" - $DSCContent += " `$CertificatePassword`r`n" + $DSCContent += " `$GlobalAdminAccount`r`n" $DSCContent += " )`r`n`r`n" - $DSCContent += " if (`$null -eq `$CertificatePassword)`r`n" + $DSCContent += " if (`$null -eq `$GlobalAdminAccount)`r`n" $DSCContent += " {`r`n" $DSCContent += " <# Credentials #>`r`n" $DSCContent += " }`r`n" $DSCContent += " else`r`n" $DSCContent += " {`r`n" - $DSCContent += " `$CredsCertificatePassword = `$CertificatePassword`r`n" + $DSCContent += " `$Credsglobaladmin = `$GlobalAdminAccount`r`n" $DSCContent += " }`r`n`r`n" + $DSCContent += " `$OrganizationName = `$Credsglobaladmin.UserName.Split('@')[1]`r`n" } - - $DSCContent += " `$OrganizationName = `$ConfigurationData.NonNodeData.OrganizationName`r`n" - Add-ConfigurationDataEntry -Node "NonNodeData" ` - -Key "OrganizationName" ` - -Value $organization ` - -Description "Tenant's default verified domain name" - Add-ConfigurationDataEntry -Node "NonNodeData" ` - -Key "ApplicationId" ` - -Value $ApplicationId ` - -Description "Azure AD Application Id for Authentication" - if (-not [System.String]::IsNullOrEmpty($TenantId)) + else { + if (-not [System.String]::IsNullOrEmpty($CertificatePassword)) + { + $DSCContent += " param (`r`n" + $DSCContent += " [parameter()]`r`n" + $DSCContent += " [System.Management.Automation.PSCredential]`r`n" + $DSCContent += " `$CertificatePassword`r`n" + $DSCContent += " )`r`n`r`n" + $DSCContent += " if (`$null -eq `$CertificatePassword)`r`n" + $DSCContent += " {`r`n" + $DSCContent += " <# Credentials #>`r`n" + $DSCContent += " }`r`n" + $DSCContent += " else`r`n" + $DSCContent += " {`r`n" + $DSCContent += " `$CredsCertificatePassword = `$CertificatePassword`r`n" + $DSCContent += " }`r`n`r`n" + } + + $DSCContent += " `$OrganizationName = `$ConfigurationData.NonNodeData.OrganizationName`r`n" Add-ConfigurationDataEntry -Node "NonNodeData" ` - -Key "TenantId" ` - -Value $TenantId ` - -Description "The Id or Name of the tenant to authenticate against" + -Key "OrganizationName" ` + -Value $organization ` + -Description "Tenant's default verified domain name" + Add-ConfigurationDataEntry -Node "NonNodeData" ` + -Key "ApplicationId" ` + -Value $ApplicationId ` + -Description "Azure AD Application Id for Authentication" + if (-not [System.String]::IsNullOrEmpty($TenantId)) + { + Add-ConfigurationDataEntry -Node "NonNodeData" ` + -Key "TenantId" ` + -Value $TenantId ` + -Description "The Id or Name of the tenant to authenticate against" + } + + if (-not [System.String]::IsNullOrEmpty($CertificatePath)) + { + Add-ConfigurationDataEntry -Node "NonNodeData" ` + -Key "CertificatePath" ` + -Value $CertificatePath ` + -Description "Local path to the .pfx certificate to use for authentication" + } + + if (-not [System.String]::IsNullOrEmpty($CertificateThumbprint)) + { + Add-ConfigurationDataEntry -Node "NonNodeData" ` + -Key "CertificateThumbprint" ` + -Value $CertificateThumbprint ` + -Description "Thumbprint of the certificate to use for authentication" + } } + [array]$ModuleVersion = Get-Module Microsoft365DSC + $ModuleVersion = $ModuleVersion[0] + $DSCContent += " Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '$version'`r`n`r`n" + $DSCContent += " Node localhost`r`n" + $DSCContent += " {`r`n" + + Add-ConfigurationDataEntry -Node "localhost" ` + -Key "ServerNumber" ` + -Value "0" ` + -Description "Default Value Used to Ensure a Configuration Data File is Generated" - if (-not [System.String]::IsNullOrEmpty($CertificatePath)) + if ($ConnectionMode -eq 'Credential') { - Add-ConfigurationDataEntry -Node "NonNodeData" ` - -Key "CertificatePath" ` - -Value $CertificatePath ` - -Description "Local path to the .pfx certificate to use for authentication" + # Add the GlobalAdminAccount to the Credentials List + Save-Credentials -UserName "globaladmin" } - - if (-not [System.String]::IsNullOrEmpty($CertificateThumbprint)) + else { - Add-ConfigurationDataEntry -Node "NonNodeData" ` - -Key "CertificateThumbprint" ` - -Value $CertificateThumbprint ` - -Description "Thumbprint of the certificate to use for authentication" + Save-Credentials -UserName "certificatepassword" } - } - [array]$ModuleVersion = Get-Module Microsoft365DSC - $ModuleVersion = $ModuleVersion[0] - $DSCContent += " Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '$version'`r`n`r`n" - $DSCContent += " Node localhost`r`n" - $DSCContent += " {`r`n" - - Add-ConfigurationDataEntry -Node "localhost" ` - -Key "ServerNumber" ` - -Value "0" ` - -Description "Default Value Used to Ensure a Configuration Data File is Generated" - - if ($ConnectionMode -eq 'Credential') - { - # Add the GlobalAdminAccount to the Credentials List - Save-Credentials -UserName "globaladmin" - } - else - { - Save-Credentials -UserName "certificatepassword" - } - $ResourcesPath = Join-Path -Path $PSScriptRoot ` - -ChildPath "..\DSCResources\" ` - -Resolve - $AllResources = Get-ChildItem $ResourcesPath -Recurse | Where-Object { $_.Name -like 'MSFT_*.psm1' } + $ResourcesPath = Join-Path -Path $PSScriptRoot ` + -ChildPath "..\DSCResources\" ` + -Resolve + $AllResources = Get-ChildItem $ResourcesPath -Recurse | Where-Object { $_.Name -like 'MSFT_*.psm1' } - $i = 1 - $ResourcesToExport = @() - foreach ($ResourceModule in $AllResources) - { - try + $i = 1 + $ResourcesToExport = @() + foreach ($ResourceModule in $AllResources) { - $resourceName = $ResourceModule.Name.Split('.')[0].Replace('MSFT_', '') - [array]$currentWorkload = $ResourceName.Substring(0, 2) - switch ($currentWorkload.ToUpper()) + try { - 'AA' - { - $currentWorkload = 'AAD'; - break - } - 'EX' - { - $currentWorkload = 'EXO'; - break - } - 'IN' - { - $currentWorkload = 'INTUNE'; - break - } - 'O3' - { - $currentWorkload = 'O365'; - break - } - 'OD' - { - $currentWorkload = 'OD'; - break - } - 'PL' - { - $currentWorkload = 'PLANNER'; - break - } - 'PP' - { - $currentWorkload = 'PP'; - break - } - 'SC' - { - $currentWorkload = 'SC'; - break - } - 'SP' - { - $currentWorkload = 'SPO'; - break - } - 'TE' + $resourceName = $ResourceModule.Name.Split('.')[0].Replace('MSFT_', '') + [array]$currentWorkload = $ResourceName.Substring(0, 2) + switch ($currentWorkload.ToUpper()) { - $currentWorkload = 'Teams'; - break + 'AA' + { + $currentWorkload = 'AAD'; + break + } + 'EX' + { + $currentWorkload = 'EXO'; + break + } + 'IN' + { + $currentWorkload = 'INTUNE'; + break + } + 'O3' + { + $currentWorkload = 'O365'; + break + } + 'OD' + { + $currentWorkload = 'OD'; + break + } + 'PL' + { + $currentWorkload = 'PLANNER'; + break + } + 'PP' + { + $currentWorkload = 'PP'; + break + } + 'SC' + { + $currentWorkload = 'SC'; + break + } + 'SP' + { + $currentWorkload = 'SPO'; + break + } + 'TE' + { + $currentWorkload = 'Teams'; + break + } + default + { + $currentWorkload = $null; + break + } } - default + if (($null -ne $ComponentsToExtract -and + ($ComponentsToExtract -contains $resourceName -or $ComponentsToExtract -contains ("chck" + $resourceName))) -or + $AllComponents -or ` + ($null -eq $ComponentsToExtract -and $null -eq $Workloads) -and ` + ($ComponentsToExtractSpecified -or -not $ComponentsToSkip.Contains($resourceName))) { - $currentWorkload = $null; - break + $ResourcesToExport += $ResourceModule } } - if (($null -ne $ComponentsToExtract -and - ($ComponentsToExtract -contains $resourceName -or $ComponentsToExtract -contains ("chck" + $resourceName))) -or - $AllComponents -or ` - ($null -eq $ComponentsToExtract -and $null -eq $Workloads) -and ` - ($ComponentsToExtractSpecified -or -not $ComponentsToSkip.Contains($resourceName))) + catch { - $ResourcesToExport += $ResourceModule + New-M365DSCLogEntry -Error $_ -Message $ResourceModule.Name -Source "[M365DSCReverse]$($ResourceModule.Name)" } } - catch - { - New-M365DSCLogEntry -Error $_ -Message $ResourceModule.Name -Source "[M365DSCReverse]$($ResourceModule.Name)" - } - } - foreach ($resource in $ResourcesToExport) - { - Import-Module $resource.FullName | Out-Null - $MaxProcessesExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("MaxProcesses") - $AppSecretExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("ApplicationSecret") - $CertThumbprintExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("CertificateThumbprint") - $TenantIdExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("TenantId") - $AppIdExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("ApplicationId") - $GlobalAdminExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("GlobalAdminAccount") - $CertPathExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("CertificatePath") - $CertPasswordExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("CertificatePassword") - - $parameters = @{} - if ($GlobalAdminExists -and -not [System.String]::IsNullOrEmpty($GlobalAdminAccount)) - { - $parameters.Add("GlobalAdminAccount", $GlobalAdminAccount) - } - if ($MaxProcessesExists -and -not [System.String]::IsNullOrEmpty($MaxProcesses)) - { - $parameters.Add("MaxProcesses", $MaxProcesses) - } - if ($AppSecretExists -and -not [System.String]::IsNullOrEmpty($ApplicationSecret)) - { - $parameters.Add("AppplicationSecret", $ApplicationSecret) - } - if ($CertThumbprintExists -and -not [System.String]::IsNullOrEmpty($CertificateThumbprint)) - { - $parameters.Add("CertificateThumbprint", $CertificateThumbprint) - } - if ($TenantIdExists -and -not [System.String]::IsNullOrEmpty($TenantId)) - { - $parameters.Add("TenantId", $TenantId) - } - if ($AppIdExists -and -not [System.String]::IsNullOrEmpty($ApplicationId)) - { - $parameters.Add("ApplicationId", $ApplicationId) - } - if ($CertPathExists -and -not [System.String]::IsNullOrEmpty($CertificatePath)) - { - $parameters.Add("CertificatePath", $CertificatePath) - } - if ($CertPasswordExists -and $null -ne $CertificatePassword) - { - $parameters.Add("CertificatePassword", $CertificatePassword) - } - if ($ComponentsToSkip -notcontains $resourceName) + foreach ($resource in $ResourcesToExport) { - Write-Host "[$i/$($ResourcesToExport.Length)] Extracting [$($resource.Name.Split('.')[0].Replace('MSFT_', ''))]..." -NoNewline - $exportString = "" - if ($GenerateInfo) + Import-Module $resource.FullName | Out-Null + $MaxProcessesExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("MaxProcesses") + $AppSecretExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("ApplicationSecret") + $CertThumbprintExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("CertificateThumbprint") + $TenantIdExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("TenantId") + $AppIdExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("ApplicationId") + $GlobalAdminExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("GlobalAdminAccount") + $CertPathExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("CertificatePath") + $CertPasswordExists = (Get-Command 'Export-TargetResource').Parameters.Keys.Contains("CertificatePassword") + + $parameters = @{} + if ($GlobalAdminExists -and -not [System.String]::IsNullOrEmpty($GlobalAdminAccount)) + { + $parameters.Add("GlobalAdminAccount", $GlobalAdminAccount) + } + if ($MaxProcessesExists -and -not [System.String]::IsNullOrEmpty($MaxProcesses)) + { + $parameters.Add("MaxProcesses", $MaxProcesses) + } + if ($AppSecretExists -and -not [System.String]::IsNullOrEmpty($ApplicationSecret)) + { + $parameters.Add("AppplicationSecret", $ApplicationSecret) + } + if ($CertThumbprintExists -and -not [System.String]::IsNullOrEmpty($CertificateThumbprint)) + { + $parameters.Add("CertificateThumbprint", $CertificateThumbprint) + } + if ($TenantIdExists -and -not [System.String]::IsNullOrEmpty($TenantId)) { - $exportString += "`r`n # For information on how to use this resource, please refer to:`r`n" - $exportString += " # https://github.com/microsoft/Microsoft365DSC/wiki/$($resource.Name.Split('.')[0].Replace('MSFT_', ''))`r`n" + $parameters.Add("TenantId", $TenantId) } - $exportString += Export-TargetResource @parameters - $i++ + if ($AppIdExists -and -not [System.String]::IsNullOrEmpty($ApplicationId)) + { + $parameters.Add("ApplicationId", $ApplicationId) + } + if ($CertPathExists -and -not [System.String]::IsNullOrEmpty($CertificatePath)) + { + $parameters.Add("CertificatePath", $CertificatePath) + } + if ($CertPasswordExists -and $null -ne $CertificatePassword) + { + $parameters.Add("CertificatePassword", $CertificatePassword) + } + if ($ComponentsToSkip -notcontains $resourceName) + { + Write-Host "[$i/$($ResourcesToExport.Length)] Extracting [$($resource.Name.Split('.')[0].Replace('MSFT_', ''))]..." -NoNewline + $exportString = "" + if ($GenerateInfo) + { + $exportString += "`r`n # For information on how to use this resource, please refer to:`r`n" + $exportString += " # https://github.com/microsoft/Microsoft365DSC/wiki/$($resource.Name.Split('.')[0].Replace('MSFT_', ''))`r`n" + } + $exportString += Export-TargetResource @parameters + $i++ + } + $DSCContent += $exportString + $exportString = $null } - $DSCContent += $exportString - $exportString = $null - } - # Close the Node and Configuration declarations - $DSCContent += " }`r`n" - $DSCContent += "}`r`n" + # Close the Node and Configuration declarations + $DSCContent += " }`r`n" + $DSCContent += "}`r`n" - if ($ConnectionMode -eq 'Credential') - { - #region Add the Prompt for Required Credentials at the top of the Configuration - $credsContent = "" - foreach ($credential in $Global:CredsRepo) + if ($ConnectionMode -eq 'Credential') { - if (!$credential.ToLower().StartsWith("builtin")) + #region Add the Prompt for Required Credentials at the top of the Configuration + $credsContent = "" + foreach ($credential in $Global:CredsRepo) { - if (!$AzureAutomation) + if (!$credential.ToLower().StartsWith("builtin")) { - $credsContent += " " + (Resolve-Credentials $credential) + " = Get-Credential -Message `"Global Admin credentials`"`r`n" - } - else - { - $resolvedName = (Resolve-Credentials $credential) - $credsContent += " " + $resolvedName + " = Get-AutomationPSCredential -Name " + ($resolvedName.Replace("$", "")) + "`r`n" + if (!$AzureAutomation) + { + $credsContent += " " + (Resolve-Credentials $credential) + " = Get-Credential -Message `"Global Admin credentials`"`r`n" + } + else + { + $resolvedName = (Resolve-Credentials $credential) + $credsContent += " " + $resolvedName + " = Get-AutomationPSCredential -Name " + ($resolvedName.Replace("$", "")) + "`r`n" + } } } - } - $credsContent += "`r`n" - $startPosition = $DSCContent.IndexOf("<# Credentials #>") + 19 - $DSCContent = $DSCContent.Insert($startPosition, $credsContent) - $DSCContent += "$ConfigurationName -ConfigurationData .\ConfigurationData.psd1 -GlobalAdminAccount `$GlobalAdminAccount" - #endregion - } - else - { - if (-not [System.String]::IsNullOrEmpty($CertificatePassword)) - { - $certCreds = $Global:CredsRepo[0] - $credsContent = "" - $credsContent += " " + (Resolve-Credentials $certCreds) + " = Get-Credential -Message `"Certificate Password`"" $credsContent += "`r`n" $startPosition = $DSCContent.IndexOf("<# Credentials #>") + 19 $DSCContent = $DSCContent.Insert($startPosition, $credsContent) - $DSCContent += "$ConfigurationName -ConfigurationData .\ConfigurationData.psd1 -CertificatePassword `$CertificatePassword" + $DSCContent += "$ConfigurationName -ConfigurationData .\ConfigurationData.psd1 -GlobalAdminAccount `$GlobalAdminAccount" + #endregion } else { - $DSCContent += "$ConfigurationName -ConfigurationData .\ConfigurationData.psd1" + if (-not [System.String]::IsNullOrEmpty($CertificatePassword)) + { + $certCreds = $Global:CredsRepo[0] + $credsContent = "" + $credsContent += " " + (Resolve-Credentials $certCreds) + " = Get-Credential -Message `"Certificate Password`"" + $credsContent += "`r`n" + $startPosition = $DSCContent.IndexOf("<# Credentials #>") + 19 + $DSCContent = $DSCContent.Insert($startPosition, $credsContent) + $DSCContent += "$ConfigurationName -ConfigurationData .\ConfigurationData.psd1 -CertificatePassword `$CertificatePassword" + } + else + { + $DSCContent += "$ConfigurationName -ConfigurationData .\ConfigurationData.psd1" + } } - } - #region Benchmarks - $M365DSCExportEndTime = [System.DateTime]::Now - $timeTaken = New-TimeSpan -Start ($M365DSCExportStartTime.ToString()) ` - -End ($M365DSCExportEndTime.ToString()) - Write-Host "$($Global:M365DSCEmojiHourglass) Export took {" -NoNewline - Write-Host "$($timeTaken.TotalSeconds) seconds" -NoNewline -ForegroundColor Cyan - Write-Host "}" - #endregion - - $shouldOpenOutputDirectory = !$Quiet - #region Prompt the user for a location to save the extract and generate the files - if ([System.String]::IsNullOrEmpty($Path)) - { - $shouldOpenOutputDirectory = $true - $OutputDSCPath = Read-Host "`r`nDestination Path" - } - else - { - $OutputDSCPath = $Path - } + #region Benchmarks + $M365DSCExportEndTime = [System.DateTime]::Now + $timeTaken = New-TimeSpan -Start ($M365DSCExportStartTime.ToString()) ` + -End ($M365DSCExportEndTime.ToString()) + Write-Host "$($Global:M365DSCEmojiHourglass) Export took {" -NoNewline + Write-Host "$($timeTaken.TotalSeconds) seconds" -NoNewline -ForegroundColor Cyan + Write-Host "}" + #endregion - if ([System.String]::IsNullOrEmpty($OutputDSCPath)) - { - $OutputDSCPath = '.' - } + $shouldOpenOutputDirectory = !$Quiet + #region Prompt the user for a location to save the extract and generate the files + if ([System.String]::IsNullOrEmpty($Path)) + { + $shouldOpenOutputDirectory = $true + $OutputDSCPath = Read-Host "`r`nDestination Path" + } + else + { + $OutputDSCPath = $Path + } - while ((Test-Path -Path $OutputDSCPath -PathType Container -ErrorAction SilentlyContinue) -eq $false) - { - try + if ([System.String]::IsNullOrEmpty($OutputDSCPath)) { - Write-Host "Directory `"$OutputDSCPath`" doesn't exist; creating..." - New-Item -Path $OutputDSCPath -ItemType Directory | Out-Null - if ($?) + $OutputDSCPath = '.' + } + + while ((Test-Path -Path $OutputDSCPath -PathType Container -ErrorAction SilentlyContinue) -eq $false) + { + try { - break + Write-Host "Directory `"$OutputDSCPath`" doesn't exist; creating..." + New-Item -Path $OutputDSCPath -ItemType Directory | Out-Null + if ($?) + { + break + } } + catch + { + Write-Warning "$($_.Exception.Message)" + Write-Warning "Could not create folder $OutputDSCPath!" + } + $OutputDSCPath = Read-Host "Please Provide Output Folder for DSC Configuration (Will be Created as Necessary)" } - catch + <## Ensures the path we specify ends with a Slash, in order to make sure the resulting file path is properly structured. #> + if (!$OutputDSCPath.EndsWith("\") -and !$OutputDSCPath.EndsWith("/")) { - Write-Warning "$($_.Exception.Message)" - Write-Warning "Could not create folder $OutputDSCPath!" + $OutputDSCPath += "\" } - $OutputDSCPath = Read-Host "Please Provide Output Folder for DSC Configuration (Will be Created as Necessary)" - } - <## Ensures the path we specify ends with a Slash, in order to make sure the resulting file path is properly structured. #> - if (!$OutputDSCPath.EndsWith("\") -and !$OutputDSCPath.EndsWith("/")) - { - $OutputDSCPath += "\" - } - #endregion + #endregion - #region Copy Downloaded files back into output folder - if (($null -ne $ComponentsToExtract -and - $ComponentsToExtract.Contains("chckSPOApp")) -or - $AllComponents -or ($null -ne $Workloads -and $Workloads.Contains('SPO'))) - { - if ($ConnectionMode -eq 'credential') + #region Copy Downloaded files back into output folder + if (($null -ne $ComponentsToExtract -and + $ComponentsToExtract.Contains("chckSPOApp")) -or + $AllComponents -or ($null -ne $Workloads -and $Workloads.Contains('SPO'))) + { + if ($ConnectionMode -eq 'credential') + { + $filesToDownload = Get-AllSPOPackages -GlobalAdminAccount $GlobalAdminAccount + } + else + { + $filesToDownload = Get-AllSPOPackages -ApplicationId $ApplicationId -CertificateThumbprint $CertificateThumbprint ` + -CertificatePassword $CertificatePassword -TenantId $TenantId -CertificatePath $CertificatePath + } + if ($filesToDownload.Count -gt 0) + { + foreach ($fileToCopy in $filesToDownload) + { + $filePath = Join-Path $env:Temp $fileToCopy.Name -Resolve + $destPath = Join-Path $OutputDSCPath $fileToCopy.Name + Copy-Item -Path $filePath -Destination $destPath + } + } + } + #endregion + + if (-not [System.String]::IsNullOrEmpty($FileName)) { - $filesToDownload = Get-AllSPOPackages -GlobalAdminAccount $GlobalAdminAccount + $outputDSCFile = $OutputDSCPath + $FileName } else { - $filesToDownload = Get-AllSPOPackages -ApplicationId $ApplicationId -CertificateThumbprint $CertificateThumbprint ` - -CertificatePassword $CertificatePassword -TenantId $TenantId -CertificatePath $CertificatePath + $outputDSCFile = $OutputDSCPath + "M365TenantConfig.ps1" } - if ($filesToDownload.Count -gt 0) + $DSCContent | Out-File $outputDSCFile + + if (!$AzureAutomation) { - foreach ($fileToCopy in $filesToDownload) + $LCMConfig = Get-DscLocalConfigurationManager + if ($null -ne $LCMConfig.CertificateID) { - $filePath = Join-Path $env:Temp $fileToCopy.Name -Resolve - $destPath = Join-Path $OutputDSCPath $fileToCopy.Name - Copy-Item -Path $filePath -Destination $destPath + try + { + # Export the certificate assigned to the LCM + $certPath = $OutputDSCPath + "M365DSC.cer" + Export-Certificate -FilePath $certPath ` + -Cert "cert:\LocalMachine\my\$($LCMConfig.CertificateID)" ` + -Type CERT ` + -NoClobber | Out-Null + Add-ConfigurationDataEntry -Node "localhost" ` + -Key "CertificateFile" ` + -Value "M365DSC.cer" ` + -Description "Path of the certificate used to encrypt credentials in the file." + } + catch + { + Write-Verbose -Message $_ + Add-M365DSCEvent -Message $_ -EntryType 'Error' ` + -EventID 1 -Source $($MyInvocation.MyCommand.Source) + } } + $outputConfigurationData = $OutputDSCPath + "ConfigurationData.psd1" + New-ConfigurationDataDocument -Path $outputConfigurationData } - } - #endregion - if (-not [System.String]::IsNullOrEmpty($FileName)) - { - $outputDSCFile = $OutputDSCPath + $FileName - } - else - { - $outputDSCFile = $OutputDSCPath + "M365TenantConfig.ps1" - } - $DSCContent | Out-File $outputDSCFile - - if (!$AzureAutomation) - { - $LCMConfig = Get-DscLocalConfigurationManager - if ($null -ne $LCMConfig.CertificateID) + if ($shouldOpenOutputDirectory) { - try - { - # Export the certificate assigned to the LCM - $certPath = $OutputDSCPath + "M365DSC.cer" - Export-Certificate -FilePath $certPath ` - -Cert "cert:\LocalMachine\my\$($LCMConfig.CertificateID)" ` - -Type CERT ` - -NoClobber | Out-Null - Add-ConfigurationDataEntry -Node "localhost" ` - -Key "CertificateFile" ` - -Value "M365DSC.cer" ` - -Description "Path of the certificate used to encrypt credentials in the file." - } - catch - { - Write-Verbose -Message $_ - Add-M365DSCEvent -Message $_ -EntryType 'Error' ` - -EventID 1 -Source $($MyInvocation.MyCommand.Source) - } + Invoke-Item -Path $OutputDSCPath } - $outputConfigurationData = $OutputDSCPath + "ConfigurationData.psd1" - New-ConfigurationDataDocument -Path $outputConfigurationData } - - if ($shouldOpenOutputDirectory) + catch { - Invoke-Item -Path $OutputDSCPath + Write-Host $_ + $partialPath = Join-Path $env:TEMP -ChildPath "$($Global:PartialExportFileName).ps1.partial" + Write-Host "Partial Export file was saved at: $partialPath" } } From e70d87cc219e86bf06430ec5004e37be26b2828a Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 19 May 2021 13:22:08 -0400 Subject: [PATCH 2/8] Fixes --- .../MSFT_TeamsVoiceRoute.psm1 | 18 +++++++++++------- .../MSFT_TeamsVoiceRoutingPolicy.psm1 | 18 +++++++++++------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 index a89678f545..c568853229 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 @@ -329,13 +329,17 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " TeamsVoiceRoute " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 index bb3177c4d3..8f0df48384 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 @@ -270,13 +270,17 @@ function Export-TargetResource Ensure = 'Present' GlobalAdminAccount = $GlobalAdminAccount } - $result = Get-TargetResource @params - $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $content += " TeamsVoiceRoutingPolicy " + (New-Guid).ToString() + "`r`n" - $content += " {`r`n" - $currentDSCBlock = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $content += Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "GlobalAdminAccount" - $content += " }`r`n" + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } From d081d288c1d02ecf4d01f47d3f8832ac3ad8ebf5 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Fri, 21 May 2021 12:31:04 -0400 Subject: [PATCH 3/8] Improvements --- .../MSFT_AADConditionalAccessPolicy.psm1 | 57 +++++++++++-------- .../MSFT_AADMSGroupLifecyclePolicy.psm1 | 5 +- .../MSFT_AADRoleDefinition.psm1 | 3 - 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/MSFT_AADConditionalAccessPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/MSFT_AADConditionalAccessPolicy.psm1 index 00f9e96afb..6a8f6cea47 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/MSFT_AADConditionalAccessPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/MSFT_AADConditionalAccessPolicy.psm1 @@ -1810,33 +1810,42 @@ function Export-TargetResource [array] $Policies = Get-AzureADMSConditionalAccessPolicy $i = 1 $dscContent = '' - Write-Host "`r`n" -NoNewline - foreach ($Policy in $Policies) + + if ($Policies.Length -eq 0) { - Write-Host " |---[$i/$($Policies.Count)] $($Policy.DisplayName)" -NoNewline - $Params = @{ - GlobalAdminAccount = $GlobalAdminAccount - DisplayName = $Policy.DisplayName - Id = $Policy.Id - ApplicationId = $ApplicationId - TenantId = $TenantId - CertificateThumbprint = $CertificateThumbprint - } - $Results = Get-TargetResource @Params - $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` - -Results $Results - $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` - -ConnectionMode $ConnectionMode ` - -ModulePath $PSScriptRoot ` - -Results $Results ` - -GlobalAdminAccount $GlobalAdminAccount - - $dscContent += $currentDSCBlock - Save-M365DSCPartialExport -Content $currentDSCBlock ` - -FileName $Global:PartialExportFileName Write-Host $Global:M365DSCEmojiGreenCheckMark - $i++ } + else + { + Write-Host "`r`n" -NoNewline + foreach ($Policy in $Policies) + { + Write-Host " |---[$i/$($Policies.Count)] $($Policy.DisplayName)" -NoNewline + $Params = @{ + GlobalAdminAccount = $GlobalAdminAccount + DisplayName = $Policy.DisplayName + Id = $Policy.Id + ApplicationId = $ApplicationId + TenantId = $TenantId + CertificateThumbprint = $CertificateThumbprint + } + $Results = Get-TargetResource @Params + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -GlobalAdminAccount $GlobalAdminAccount + + $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName + Write-Host $Global:M365DSCEmojiGreenCheckMark + $i++ + } + } + return $dscContent } catch diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroupLifecyclePolicy/MSFT_AADMSGroupLifecyclePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroupLifecyclePolicy/MSFT_AADMSGroupLifecyclePolicy.psm1 index bbd3eb7d7c..52467ca8df 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroupLifecyclePolicy/MSFT_AADMSGroupLifecyclePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroupLifecyclePolicy/MSFT_AADMSGroupLifecyclePolicy.psm1 @@ -420,11 +420,10 @@ function Export-TargetResource -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount $dscContent += $currentDSCBlock + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName } - Save-M365DSCPartialExport -Content $currentDSCBlock ` - -FileName $Global:PartialExportFileName - Write-Host $Global:M365DSCEmojiGreenCheckMark return $dscContent diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/MSFT_AADRoleDefinition.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/MSFT_AADRoleDefinition.psm1 index e74d60fc2b..ac676bd566 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/MSFT_AADRoleDefinition.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/MSFT_AADRoleDefinition.psm1 @@ -398,9 +398,6 @@ function Export-TargetResource $dscContent += $currentDSCBlock Save-M365DSCPartialExport -Content $currentDSCBlock ` -FileName $Global:PartialExportFileName - - Write-Host $Global:M365DSCEmojiGreenCheckMark - $i++ } Write-Host $Global:M365DSCEmojiGreenCheckMark From 8ed53edb153d88cf969d56595a9b9b8c4a1777bd Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 26 May 2021 06:32:33 -0400 Subject: [PATCH 4/8] Fixes --- .../MSFT_TeamsEmergencyCallRoutingPolicy.psm1 | 2 +- .../MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 index 1035d7c5bb..912a1e3834 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 @@ -344,7 +344,7 @@ function Export-TargetResource $i++ Write-Host $Global:M365DSCEmojiGreenCheckMark } - return $content + return $dscContent } catch { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 index 545a6a534d..fd59a735ae 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource $GlobalAdminAccount ) $ConnectionMode = New-M365DSCConnection -Platform 'MicrosoftTeams' ` - -InboundParameters $PSBoundParameters + -InboundParameters $PSBoundParameters #region Telemetry $ResourceName = $MyInvocation.MyCommand.ModuleName.Replace("MSFT_", "") @@ -40,7 +40,7 @@ function Get-TargetResource { $policy = Get-CsTeamsUpgradePolicy -Identity $Identity ` -ErrorAction SilentlyContinue - [array]$users = Get-CSOnlineUser | Where-Object -Filter { $_.TeamsUpgradePolicy -eq $Identity } + [array]$users = Get-CsOnlineUser | Where-Object -Filter { $_.TeamsUpgradePolicy -eq $Identity } if ($null -eq $policy) { @@ -124,7 +124,7 @@ function Set-TargetResource foreach ($user in $Users) { Write-Verbose -Message "Granting TeamsUpgradePolicy {$Identity} to User {$user} with MigrateMeetingsToTeams=$MigrateMeetingsToTeams" - Grant-CSTeamsUpgradePolicy -PolicyName $Identity -Identity $user -MigrateMeetingsToTeams:$MigrateMeetingsToTeams + Grant-CsTeamsUpgradePolicy -PolicyName $Identity -Identity $user -MigrateMeetingsToTeams:$MigrateMeetingsToTeams } } @@ -224,7 +224,7 @@ function Export-TargetResource } $result = Get-TargetResource @params $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $currentDSCBlock += " TeamsUpgradePolicy " + (New-Guid).ToString() + "`r`n" + $currentDSCBlock = " TeamsUpgradePolicy " + (New-Guid).ToString() + "`r`n" $currentDSCBlock += " {`r`n" $currentDSCBlock2 = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot $partialContent = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock2 -ParameterName "GlobalAdminAccount" From d6efaab56f9c9178e620b1be1b3a06663c795a6d Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 26 May 2021 10:54:21 -0400 Subject: [PATCH 5/8] Fixed UnitTests --- .../MSFT_EXOActiveSyncDeviceAccessRule.psm1 | 6 ++---- .../MSFT_TeamsUpgradePolicy.psm1 | 5 +++-- ...crosoft365DSC.EXOClientAccessRule.Tests.ps1 | 1 + ...rosoft365DSC.EXODkimSigningConfig.Tests.ps1 | 18 +++++++----------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOActiveSyncDeviceAccessRule/MSFT_EXOActiveSyncDeviceAccessRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOActiveSyncDeviceAccessRule/MSFT_EXOActiveSyncDeviceAccessRule.psm1 index 1f7ed1cbfe..72daefb985 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOActiveSyncDeviceAccessRule/MSFT_EXOActiveSyncDeviceAccessRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOActiveSyncDeviceAccessRule/MSFT_EXOActiveSyncDeviceAccessRule.psm1 @@ -405,8 +405,8 @@ function Export-TargetResource $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` -Results $Results - $dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName ` - currentDSCBlocktonMode $ConnectionMode ` + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` -ModulePath $PSScriptRoot ` -Results $Results ` -GlobalAdminAccount $GlobalAdminAccount @@ -446,5 +446,3 @@ function Export-TargetResource } Export-ModuleMember -Function *-TargetResource - - diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 index fd59a735ae..5b075d7981 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 @@ -226,8 +226,9 @@ function Export-TargetResource $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" $currentDSCBlock = " TeamsUpgradePolicy " + (New-Guid).ToString() + "`r`n" $currentDSCBlock += " {`r`n" - $currentDSCBlock2 = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot - $partialContent = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock2 -ParameterName "GlobalAdminAccount" + $partialContent = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot + $partialContent = Convert-DSCStringParamToVariable -DSCBlock $partialContent ` + -ParameterName "GlobalAdminAccount" if ($partialContent.ToLower().IndexOf($organization.ToLower()) -gt 0) { $partialContent = $partialContent -ireplace [regex]::Escape("@" + $organization), "@`$OrganizationName" diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOClientAccessRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOClientAccessRule.Tests.ps1 index 156de7be4f..427de8a6e7 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOClientAccessRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOClientAccessRule.Tests.ps1 @@ -213,6 +213,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-ClientAccessRule -MockWith { return @{ Identity = 'ExampleCASRule' + Action = 'AllowAccess' } } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODkimSigningConfig.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODkimSigningConfig.Tests.ps1 index c892126789..1768f5c70f 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODkimSigningConfig.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODkimSigningConfig.Tests.ps1 @@ -2,14 +2,14 @@ param( ) $M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` - -ChildPath "..\..\Unit" ` - -Resolve + -ChildPath "..\..\Unit" ` + -Resolve $CmdletModule = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Microsoft365.psm1" ` - -Resolve) + -ChildPath "\Stubs\Microsoft365.psm1" ` + -Resolve) $GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Generic.psm1" ` - -Resolve) + -ChildPath "\Stubs\Generic.psm1" ` + -Resolve) Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` -ChildPath "\UnitTestHelper.psm1" ` -Resolve) @@ -54,10 +54,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-DkimSigningConfig -MockWith { } - - Mock -CommandName Confirm-ImportedCmdletIsAvailable -MockWith { - return $true - } } # Test contexts @@ -92,7 +88,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "DkimSigningConfig update not required." -Fixture { BeforeAll { - $testParams = @{ + $testParams = @{ Ensure = 'Present' Identity = 'contoso.com' GlobalAdminAccount = $GlobalAdminAccount From 75c69641ff0a016d9f60b2f1985bec6e4c766116 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 26 May 2021 15:43:58 -0400 Subject: [PATCH 6/8] Fixes to schema --- .../MSFT_IntuneDeviceCompliancePolicyMacOS.schema.mof | 4 ++-- .../MSFT_IntuneDeviceCompliancePolicyWindows10.schema.mof | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyMacOS/MSFT_IntuneDeviceCompliancePolicyMacOS.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyMacOS/MSFT_IntuneDeviceCompliancePolicyMacOS.schema.mof index a5f7ea231d..b4b86bc2ba 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyMacOS/MSFT_IntuneDeviceCompliancePolicyMacOS.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyMacOS/MSFT_IntuneDeviceCompliancePolicyMacOS.schema.mof @@ -10,12 +10,12 @@ class MSFT_IntuneDeviceCompliancePolicyMacOS : OMI_BaseResource [Write, Description("PasswordMinutesOfInactivityBeforeLock of the MacOS device compliance policy.")] Uint32 PasswordMinutesOfInactivityBeforeLock; [Write, Description("PasswordPreviousPasswordBlockCount of the MacOS device compliance policy.")] Uint32 PasswordPreviousPasswordBlockCount; [Write, Description("PasswordMinimumCharacterSetCount of the MacOS device compliance policy.")] Uint32 PasswordMinimumCharacterSetCount; - [Write, Description("PasswordRequiredType of the MacOS device compliance policy.")], ValueMap{"DeviceDefault","Alphanumeric","Numeric"}, Values{"DeviceDefault","Alphanumeric","Numeric"}] String PasswordRequiredType; + [Write, Description("PasswordRequiredType of the MacOS device compliance policy."), ValueMap{"DeviceDefault","Alphanumeric","Numeric"}, Values{"DeviceDefault","Alphanumeric","Numeric"}] String PasswordRequiredType; [Write, Description("OsMinimumVersion of the MacOS device compliance policy.")] String OsMinimumVersion; [Write, Description("OsMaximumVersion of the MacOS device compliance policy.")] String OsMaximumVersion; [Write, Description("SystemIntegrityProtectionEnabled of the MacOS device compliance policy.")] Boolean SystemIntegrityProtectionEnabled; [Write, Description("DeviceThreatProtectionEnabled of the MacOS device compliance policy.")] Boolean DeviceThreatProtectionEnabled; - [Write, Description("DeviceThreatProtectionRequiredSecurityLevel of the MacOS device compliance policy.")], ValueMap{"Unavailable","Secured","Low", "Medium","High","NotSet"}, Values{"Unavailable","Secured","Low", "Medium","High","NotSet"} String DeviceThreatProtectionRequiredSecurityLevel; + [Write, Description("DeviceThreatProtectionRequiredSecurityLevel of the MacOS device compliance policy."), ValueMap{"Unavailable","Secured","Low", "Medium","High","NotSet"}, Values{"Unavailable","Secured","Low", "Medium","High","NotSet"}] String DeviceThreatProtectionRequiredSecurityLevel; [Write, Description("StorageRequireEncryption of the MacOS device compliance policy.")] Boolean StorageRequireEncryption; [Write, Description("FirewallEnabled of the MacOS device compliance policy.")] Boolean FirewallEnabled; [Write, Description("FirewallBlockAllIncoming of the MacOS device compliance policy.")] Boolean FirewallBlockAllIncoming; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyWindows10/MSFT_IntuneDeviceCompliancePolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyWindows10/MSFT_IntuneDeviceCompliancePolicyWindows10.schema.mof index db5e9a4729..5d516be1d5 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyWindows10/MSFT_IntuneDeviceCompliancePolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceCompliancePolicyWindows10/MSFT_IntuneDeviceCompliancePolicyWindows10.schema.mof @@ -10,7 +10,7 @@ class MSFT_IntuneDeviceCompliancePolicyWindows10 : OMI_BaseResource [Write, Description("PasswordExpirationDays of the Windows 10 device compliance policy.")] Uint32 PasswordExpirationDays; [Write, Description("PasswordMinimumLength of the Windows 10 device compliance policy.")] Uint32 PasswordMinimumLength; [Write, Description("PasswordMinimumCharacterSetCount of the Windows 10 device compliance policy.")] Uint32 PasswordMinimumCharacterSetCount; - [Write, Description("PasswordRequiredType of the Windows 10 device compliance policy.")], ValueMap{"DeviceDefault","Alphanumeric","Numeric"}, Values{"DeviceDefault","Alphanumeric","Numeric"}] String PasswordRequiredType; + [Write, Description("PasswordRequiredType of the Windows 10 device compliance policy."), ValueMap{"DeviceDefault","Alphanumeric","Numeric"}, Values{"DeviceDefault","Alphanumeric","Numeric"}] String PasswordRequiredType; [Write, Description("PasswordPreviousPasswordBlockCount of the Windows 10 device compliance policy.")] Uint32 PasswordPreviousPasswordBlockCount; [Write, Description("RequireHealthyDeviceReport of the Windows 10 device compliance policy.")] Boolean RequireHealthyDeviceReport; [Write, Description("OsMinimumVersion of the Windows 10 device compliance policy.")] String OsMinimumVersion; @@ -30,11 +30,11 @@ class MSFT_IntuneDeviceCompliancePolicyWindows10 : OMI_BaseResource [Write, Description("AntivirusRequired of the Windows 10 device compliance policy.")] Boolean AntivirusRequired; [Write, Description("AntiSpywareRequired of the Windows 10 device compliance policy.")] Boolean AntiSpywareRequired; [Write, Description("DeviceThreatProtectionEnabled of the Windows 10 device compliance policy.")] Boolean DeviceThreatProtectionEnabled; - [Write, Description("DeviceThreatProtectionRequiredSecurityLevel of the Windows 10 device compliance policy.")], ValueMap{"Unavailable","Secured","Low", "Medium","High","NotSet"}, Values{"Unavailable","Secured","Low", "Medium","High","NotSet"} String DeviceThreatProtectionRequiredSecurityLevel; + [Write, Description("DeviceThreatProtectionRequiredSecurityLevel of the Windows 10 device compliance policy."), ValueMap{"Unavailable","Secured","Low", "Medium","High","NotSet"}, Values{"Unavailable","Secured","Low", "Medium","High","NotSet"}] String DeviceThreatProtectionRequiredSecurityLevel; [Write, Description("ConfigurationManagerComplianceRequired of the Windows 10 device compliance policy.")] Boolean ConfigurationManagerComplianceRequired; [Write, Description("TPMRequired of the Windows 10 device compliance policy.")] Boolean TPMRequired; [Write, Description("DeviceCompliancePolicyScript of the Windows 10 device compliance policy.")] String DeviceCompliancePolicyScript; - [Write, Description("ValidOperatingSystemBuildRanges of the Windows 10 device compliance policy.")] Array ValidOperatingSystemBuildRanges; + [Write, Description("ValidOperatingSystemBuildRanges of the Windows 10 device compliance policy.")] String ValidOperatingSystemBuildRanges[]; [Write, Description("Present ensures the policy exists, absent ensures it is removed."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; [Required, Description("Credentials of the Intune Admin"), EmbeddedInstance("MSFT_Credential")] String GlobalAdminAccount; }; From 76033338d4dcb030d08c7a17874ee75f383a9043 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 26 May 2021 15:44:22 -0400 Subject: [PATCH 7/8] Update Microsoft365DSC.psd1 --- Modules/Microsoft365DSC/Microsoft365DSC.psd1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 index bec3b32b99..227b4d17a6 100644 --- a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 +++ b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 2021-05-20 +# Generated on: 2021-05-26 @{ @@ -11,7 +11,7 @@ # RootModule = '' # Version number of this module. - ModuleVersion = '1.21.526.1' + ModuleVersion = '1.21.526.2' # Supported PSEditions # CompatiblePSEditions = @() From 03916e806d879cca8f02f68d03282a2d9e4d0b54 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 26 May 2021 15:44:44 -0400 Subject: [PATCH 8/8] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35293ed0be..fa22bea8e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Change log for Microsoft365DSC -1.21.526.1 +1.21.526.2 * EXOSafeAttachmentRule * Fixed issue #1213 Policy X already has rule Y associated with it if rule exists already