fixes - works now

This commit is contained in:
Erik Eckert 2023-11-03 14:45:26 -06:00
parent bf090b40c5
commit 5c98273ccf

View File

@ -12,17 +12,24 @@ param (
$SharedMB $SharedMB
) )
$dots = "."
$dots2 = "."
Import-Module ExchangeOnlineManagement Import-Module ExchangeOnlineManagement
Connect-IPPSSession
if (!$Session) {
$Session = Connect-IPPSSession
}
$user = get-aduser -Filter { mail -eq $ExportEmail } $user = get-aduser -Filter { mail -eq $ExportEmail }
if ($user) { if ($user) {
$ExportName = $user.Name + ' Export' $ExportName = $user.Name
} }
else { else {
$ExportName = $ExportEmail + ' Export' $ExportName = $ExportEmail
} }
## Script Variables ## Script Variables
if ($SharedMB) { if ($SharedMB) {
@ -36,36 +43,39 @@ New-ComplianceSearch $ExportName -ExchangeLocation $ExportEmail -AllowNotFoundEx
do { do {
$Status = Get-ComplianceSearch -Identity $ExportName $Status = Get-ComplianceSearch -Identity $ExportName
$Progress = { $dots += "."
$Progress = @{
ID = 1 ID = 1
Activity = $Status.status Activity = "Running Search"
Status = $dots
} }
Write-Progress @Progress Write-Progress @Progress
Start-Sleep -Seconds 10 Start-Sleep -Seconds 10
} while ($Status.status -ne 'Completed') } while ($Status.status -ne 'Completed')
$Progress = { $Progress = @{
ID = 1 ID = 1
Activity = "Starting Export..." Activity = "Starting Export..."
} }
Write-Progress @Progress Write-Progress @Progress
$Export_Action_name = New-ComplianceSearchAction $ExportName -Export -format FxStream $Export_Action_name = New-ComplianceSearchAction $ExportName -Export -format FxStream -Force
$Export_Action_name.name # $Export_Action_name.name
do { do {
$Export_Action = Get-ComplianceSearchAction -Identity $Export_Action_name.Name -IncludeCredential $Export_Action = Get-ComplianceSearchAction -Identity $Export_Action_name.Name -IncludeCredential
$dots2 += "."
$Progress = { $Progress = @{
ID = 1 ID = 1
Activity = "Running Export" Activity = "Running Export " + $Export_Action_name.Name
Status = $dots2
} }
Write-Progress @Progress Write-Progress @Progress
Start-Sleep -Seconds 10 Start-Sleep -Seconds 10
} until ($Export_Action.status -eq 'Completed') } 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 #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(' ','') #$ContainerURI = $export_action.results.split(';')[0].replace('Container url:','').replace(' ','')
# $SASToken = $export_action.results.split(';')[2].replace(' SAS token: ','') # $SASToken = $export_action.results.split(';')[2].replace(' SAS token: ','')