Can Someone help check the scripts running in the https://compliance.microsoftonline.cn/contentsearchv2 in O365

Christest1 0 Reputation points
2024-03-19T01:48:47.32+00:00

Can Someone help check the scripts?

We are using the Office 365 in Chian and in the Compliance center there we can run the tasks to use content Search function to export user emails see the links https://compliance.microsoftonline.cn/contentsearchv2 

and we have search scripts and then the Search jobs will be beginning automatically. BUT now the search shows NOT started and we need to click into by hand to rerun.

the scripts as below please someone can helps thanks for the times and helps.

Create log function

Function LogWrite

{

Param ([string]$logstring)

Add-content $Logfile -value $logstring

}

#===========================================================

$workingDir = Convert-Path .

$LogDate = get-date -f yyyyMMdd

$Logfile = "$workingDir\Logfile3_$LogDate.log"

$inputSource = Import-CSV "$workingDir\in-place_ediscovery_search_list.csv"

ForEach ($info in $inputSource )

{

$infoData = $info.Name

$infoData2 = $info.Sourcemailboxes

$infoData3 = $info.startdate

$infoData4 = $info.enddate

$error.Clear()

#To enable LitigationHold

Set-Mailbox -Identity $infodata2 -LitigationHoldEnabled $true

#To perform mailbox search in existing eDiscovery case --- please update the case name based on the real operations

New-ComplianceSearch -case "CN leaver hold" -Name "$infoData" -ExchangeLocation $infoData2 -ContentMatchQuery "date:$infoData3..$infodata4"

sleep 5

Get-ComplianceSearch -case "CN leaver hold" | where{$_.status -eq "NotStarted"} | Start-ComplianceSearch

if($error.Count -gt 0)

{

$error | %{

$LogDate2 = get-date -f "yyyy-MM-dd HH:mm"

$errorLogMSG = $_

LogWrite "($LogDate2) Error : $errorLogMSG "

}

}

}

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
871 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,189 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
{count} votes