moving to Offboarding area
This commit is contained in:
parent
8aca2b8607
commit
f8bae64af1
@ -1,92 +0,0 @@
|
||||
## Connect to the Various MS365 Platforms
|
||||
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
# Define the email address to be exported
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]
|
||||
$ExportEmail,
|
||||
# Set this flag if the mailbox is shared
|
||||
[Parameter(Mandatory = $false)]
|
||||
[switch]
|
||||
$SharedMB
|
||||
)
|
||||
|
||||
$dots = "."
|
||||
$dots2 = "."
|
||||
|
||||
Import-Module ExchangeOnlineManagement
|
||||
|
||||
if (!$Session) {
|
||||
$Session = Connect-IPPSSession
|
||||
|
||||
}
|
||||
|
||||
|
||||
$user = get-aduser -Filter { mail -eq $ExportEmail }
|
||||
|
||||
if ($user) {
|
||||
$ExportName = $user.Name
|
||||
}
|
||||
else {
|
||||
$ExportName = $ExportEmail
|
||||
}
|
||||
## Script Variables
|
||||
if ($SharedMB) {
|
||||
# add leading dot if shared mailbox
|
||||
$ExportEmail = ".$ExportEmail"
|
||||
}
|
||||
|
||||
New-ComplianceSearch $ExportName -ExchangeLocation $ExportEmail -AllowNotFoundExchangeLocationsEnabled $true | Start-ComplianceSearch
|
||||
|
||||
|
||||
|
||||
do {
|
||||
$Status = Get-ComplianceSearch -Identity $ExportName
|
||||
$dots += "."
|
||||
$Progress = @{
|
||||
ID = 1
|
||||
Activity = "Running Search"
|
||||
Status = $dots
|
||||
}
|
||||
Write-Progress @Progress
|
||||
Start-Sleep -Seconds 10
|
||||
} while ($Status.status -ne 'Completed')
|
||||
|
||||
$Progress = @{
|
||||
ID = 1
|
||||
Activity = "Starting Export..."
|
||||
}
|
||||
Write-Progress @Progress
|
||||
|
||||
$Export_Action_name = New-ComplianceSearchAction $ExportName -Export -format FxStream -Force
|
||||
# $Export_Action_name.name
|
||||
|
||||
do {
|
||||
$Export_Action = Get-ComplianceSearchAction -Identity $Export_Action_name.Name -IncludeCredential
|
||||
$dots2 += "."
|
||||
$Progress = @{
|
||||
ID = 1
|
||||
Activity = "Running Export " + $Export_Action_name.Name
|
||||
Status = $dots2
|
||||
}
|
||||
Write-Progress @Progress
|
||||
|
||||
Start-Sleep -Seconds 10
|
||||
} until ($Export_Action.status -eq 'Completed')
|
||||
|
||||
Write-Progress @Progress -Completed
|
||||
#Need to extract Container URI and SAS token from Results, and pass those to AZCopy EXE
|
||||
#$ContainerURI = $export_action.results.split(';')[0].replace('Container url:','').replace(' ','')
|
||||
# $SASToken = $export_action.results.split(';')[2].replace(' SAS token: ','')
|
||||
|
||||
Write-Output 'Process Complete: Use the SAS Token Below in the "Export" Tab of the following URL: https://compliance.microsoft.com/contentsearch'
|
||||
# Write-Output 'SAS Token: '
|
||||
# Write-Output $SASToken
|
||||
#$FullURI = $ContainerURI + $SASToken
|
||||
#$AZArgs = " cp '$FullURI' --recursive '$DestinationPath'"
|
||||
#Start-Process $AZCopyPath $AZArgs
|
||||
|
||||
#>
|
||||
Disconnect-ExchangeOnline
|
||||
|
Loading…
Reference in New Issue
Block a user