From df1e9bcb7a1ba2bcca1bea53f6291302f18cf5d5 Mon Sep 17 00:00:00 2001 From: mayanksahu11 <168190827+mayanksahu11@users.noreply.github.com> Date: Mon, 6 Jan 2025 11:38:57 +0530 Subject: [PATCH 1/6] Update Export-ContentExplorerData.md Additional tips to improve the cmdlet usage --- .../exchange/Export-ContentExplorerData.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md index c1bd868260..f701044b08 100644 --- a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md +++ b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md @@ -43,6 +43,13 @@ The output of this cmdlet contains the following information: To use this cmdlet in Security & Compliance PowerShell, you need to be assigned permissions. For more information, see [Permissions in the Microsoft Purview compliance portal](https://learn.microsoft.com/purview/microsoft-365-compliance-center-permissions). +## Scripting +- If the requirement is to export multiple SITs/Labels, it is recommended to not use a single script to export everything. Instead create a script for one SIT/Label and then re-use the same script for each SIT/Label in each workload required. +- When retrying the script, make sure to reconnect to the session first. This is because the session’s token expires after about an hour, which can cause the cmdlet to fail. To fix this issue, reconnect to the session before retrying the script. If the script fails, restart it using the last page cookie returned to continue the export from where it left off. + +>[!Tip] +>To support unattended scripts running for long time you can leverage [certificate-based authentication (CBA)](https://learn.microsoft.com/en-us/powershell/exchange/app-only-auth-powershell-v2?view=exchange-ps) flow + ## EXAMPLES ### Example 1 @@ -90,7 +97,7 @@ Accept wildcard characters: False ``` ### -Aggregate -{{ Fill Aggregate Description }} +The Aggregate parameter can be used to get the folder level aggregated numbers instead of getting the details at item level. This will significantly reduce the export time, and if needed internal items of a folder can be downloaded by running the cmdlet for specific folders. When -Aggregate parameter is passed along with TagName, TagType and Workload parameters, the cmdlet will return the list of SiteUrls (ODB/SPO) / UPNs (EXO/Teams) and the count of items stamped with that tag. ```yaml Type: SwitchParameter @@ -137,6 +144,10 @@ Accept pipeline input: False Accept wildcard characters: False ``` +>[!Note] +>In case of empty folders or folders with less files it will cause the cmdlet to run for a long time inorder to get 'PageSize' count of results. To prevent this, the Cmdlet will return the data of 5 folders or number of records as mentioned in the PageSize, whichever is completed first. +>E.g. if there are 10 folders with 1 record each then in single execution cmdlet will return 5 record of top 5 folders and in the next execution using page cookie it will return 5 records from the remaining 5 folders even if PageSize mentioned is 10. + ### -SiteUrl The SiteUrl parameter specifies the site URL to export file details from. From 63274367510b33c240333518718f34eccafcae9a Mon Sep 17 00:00:00 2001 From: mayanksahu11 <168190827+mayanksahu11@users.noreply.github.com> Date: Mon, 6 Jan 2025 13:08:19 +0530 Subject: [PATCH 2/6] Update Export-ContentExplorerData.md --- exchange/exchange-ps/exchange/Export-ContentExplorerData.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md index f701044b08..934a190287 100644 --- a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md +++ b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md @@ -43,7 +43,7 @@ The output of this cmdlet contains the following information: To use this cmdlet in Security & Compliance PowerShell, you need to be assigned permissions. For more information, see [Permissions in the Microsoft Purview compliance portal](https://learn.microsoft.com/purview/microsoft-365-compliance-center-permissions). -## Scripting +### Scripting - If the requirement is to export multiple SITs/Labels, it is recommended to not use a single script to export everything. Instead create a script for one SIT/Label and then re-use the same script for each SIT/Label in each workload required. - When retrying the script, make sure to reconnect to the session first. This is because the session’s token expires after about an hour, which can cause the cmdlet to fail. To fix this issue, reconnect to the session before retrying the script. If the script fails, restart it using the last page cookie returned to continue the export from where it left off. From ec19f93667c69600c1fa92a45fa7e9f992f9cf8f Mon Sep 17 00:00:00 2001 From: Chris Davis Date: Mon, 6 Jan 2025 09:01:16 -0800 Subject: [PATCH 3/6] Update Export-ContentExplorerData.md with best practices and paramete... ...r details --- .../exchange/Export-ContentExplorerData.md | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md index 934a190287..14a50a8b46 100644 --- a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md +++ b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md @@ -41,14 +41,17 @@ The output of this cmdlet contains the following information: - RecordsReturned: The number of records returned in the query. - PageCookie: Used to get the next set of records when MorePagesAvailable is True. +The following list describes best practices for scripts using this cmdlet: + +- We recommend not using a single script to export multiple SITs/Labels. Instead, create a script for one SIT/Label, and then re-use the same script for each SIT/Label in each workload as required. +- When retrying the script, make sure to reconnect to the session first. The session's token expires after about an hour, which can cause the cmdlet to fail. To fix this issue, reconnect to the session before retrying the script. If the script fails, restart it using the last page cookie returned to continue the export from where it left off. + + > [!TIP] + > To support unattended scripts that run for a long time, you can use [certificate-based authentication (CBA)](https://learn.microsoft.com/powershell/exchange/app-only-auth-powershell-v2?view=exchange-ps). + To use this cmdlet in Security & Compliance PowerShell, you need to be assigned permissions. For more information, see [Permissions in the Microsoft Purview compliance portal](https://learn.microsoft.com/purview/microsoft-365-compliance-center-permissions). ### Scripting -- If the requirement is to export multiple SITs/Labels, it is recommended to not use a single script to export everything. Instead create a script for one SIT/Label and then re-use the same script for each SIT/Label in each workload required. -- When retrying the script, make sure to reconnect to the session first. This is because the session’s token expires after about an hour, which can cause the cmdlet to fail. To fix this issue, reconnect to the session before retrying the script. If the script fails, restart it using the last page cookie returned to continue the export from where it left off. - ->[!Tip] ->To support unattended scripts running for long time you can leverage [certificate-based authentication (CBA)](https://learn.microsoft.com/en-us/powershell/exchange/app-only-auth-powershell-v2?view=exchange-ps) flow ## EXAMPLES @@ -97,7 +100,15 @@ Accept wildcard characters: False ``` ### -Aggregate -The Aggregate parameter can be used to get the folder level aggregated numbers instead of getting the details at item level. This will significantly reduce the export time, and if needed internal items of a folder can be downloaded by running the cmdlet for specific folders. When -Aggregate parameter is passed along with TagName, TagType and Workload parameters, the cmdlet will return the list of SiteUrls (ODB/SPO) / UPNs (EXO/Teams) and the count of items stamped with that tag. +The Aggregate parameter switch returns the folder level aggregated numbers instead of getting the details at item level. You don't need to specify a value with this switch. + +Using this switch significantly reduces the export time. To download the items in a folder, run this cmdlet for specific folders. + +When you use this switch with the TagName, TagType and Workload parameters, the command returns the following information: + +- SiteUlrs: OneDrive and SharePoint. +- UPNs: Exchange Online and Microsoft Teams. +- The count of items stamped with that tag. ```yaml Type: SwitchParameter @@ -131,6 +142,8 @@ Accept wildcard characters: False ### -PageSize The PageSize parameter specifies the maximum number of records to return in a single query. Valid input for this parameter is an integer between 1 and 10000. The default value is 100. +**Note**: In empty folders or folders with few files, this parameter can cause the command to run for a long time as it tries to get the PageSize count of the results. To prevent this issue, the command returns data from 5 folders or the number of records specified by the PageSize parameter, whichever completes first. For example, if there are 10 folders with 1 record each, the command returns 5 records of the top 5 folders. In the next execution using page cookie, it returns 5 records from the remaining 5 folders, even if the PageSize value is 10. + ```yaml Type: Int32 Parameter Sets: (All) @@ -144,10 +157,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` ->[!Note] ->In case of empty folders or folders with less files it will cause the cmdlet to run for a long time inorder to get 'PageSize' count of results. To prevent this, the Cmdlet will return the data of 5 folders or number of records as mentioned in the PageSize, whichever is completed first. ->E.g. if there are 10 folders with 1 record each then in single execution cmdlet will return 5 record of top 5 folders and in the next execution using page cookie it will return 5 records from the remaining 5 folders even if PageSize mentioned is 10. - ### -SiteUrl The SiteUrl parameter specifies the site URL to export file details from. From b71ea750bf44953354dd33e90b2167cdf9489690 Mon Sep 17 00:00:00 2001 From: Chris Davis Date: Mon, 6 Jan 2025 09:02:21 -0800 Subject: [PATCH 4/6] Update CBA link in documentation --- exchange/exchange-ps/exchange/Export-ContentExplorerData.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md index 14a50a8b46..c5e209a80a 100644 --- a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md +++ b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md @@ -47,7 +47,7 @@ The following list describes best practices for scripts using this cmdlet: - When retrying the script, make sure to reconnect to the session first. The session's token expires after about an hour, which can cause the cmdlet to fail. To fix this issue, reconnect to the session before retrying the script. If the script fails, restart it using the last page cookie returned to continue the export from where it left off. > [!TIP] - > To support unattended scripts that run for a long time, you can use [certificate-based authentication (CBA)](https://learn.microsoft.com/powershell/exchange/app-only-auth-powershell-v2?view=exchange-ps). + > To support unattended scripts that run for a long time, you can use [certificate-based authentication (CBA)](https://learn.microsoft.com/powershell/exchange/app-only-auth-powershell-v2). To use this cmdlet in Security & Compliance PowerShell, you need to be assigned permissions. For more information, see [Permissions in the Microsoft Purview compliance portal](https://learn.microsoft.com/purview/microsoft-365-compliance-center-permissions). From c2aa26764afef52276e11a3e284f7099db9c88d5 Mon Sep 17 00:00:00 2001 From: Chris Davis Date: Mon, 6 Jan 2025 09:03:21 -0800 Subject: [PATCH 5/6] Fix grammar in Export-ContentExplorerData.md --- exchange/exchange-ps/exchange/Export-ContentExplorerData.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md index c5e209a80a..558b6b33b5 100644 --- a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md +++ b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md @@ -100,7 +100,7 @@ Accept wildcard characters: False ``` ### -Aggregate -The Aggregate parameter switch returns the folder level aggregated numbers instead of getting the details at item level. You don't need to specify a value with this switch. +The Aggregate parameter switch returns the folder level aggregated numbers instead of returning details at the item level. You don't need to specify a value with this switch. Using this switch significantly reduces the export time. To download the items in a folder, run this cmdlet for specific folders. From 505383040c2d0f61fa392aa28e1b4dbd0985788d Mon Sep 17 00:00:00 2001 From: Chris Davis Date: Mon, 6 Jan 2025 09:07:58 -0800 Subject: [PATCH 6/6] Remove redundant sections and update UPNs description --- exchange/exchange-ps/exchange/Export-ContentExplorerData.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md index 558b6b33b5..ebe659a855 100644 --- a/exchange/exchange-ps/exchange/Export-ContentExplorerData.md +++ b/exchange/exchange-ps/exchange/Export-ContentExplorerData.md @@ -51,8 +51,6 @@ The following list describes best practices for scripts using this cmdlet: To use this cmdlet in Security & Compliance PowerShell, you need to be assigned permissions. For more information, see [Permissions in the Microsoft Purview compliance portal](https://learn.microsoft.com/purview/microsoft-365-compliance-center-permissions). -### Scripting - ## EXAMPLES ### Example 1 @@ -107,7 +105,7 @@ Using this switch significantly reduces the export time. To download the items i When you use this switch with the TagName, TagType and Workload parameters, the command returns the following information: - SiteUlrs: OneDrive and SharePoint. -- UPNs: Exchange Online and Microsoft Teams. +- UPNs: Exchange Online and Teams. - The count of items stamped with that tag. ```yaml @@ -230,8 +228,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` - - ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/p/?LinkID=113216).