Repair-Site
SharePoint Online: Checks and repairs a site collection
#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$Identity,
[string]$RuleId,
[switch]$RunAlways
)
Process {
try {
$cmdArgs = @{ ErrorAction = 'Stop'; Identity = $Identity; RunAlways = $RunAlways; Confirm = $false }
if (-not [System.String]::IsNullOrWhiteSpace($RuleId)) { $cmdArgs.Add('RuleId', $RuleId) }
$result = Repair-SPOSite @cmdArgs | Select-Object *
if ($null -ne $result) { foreach ($item in $result) { $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force } }
}
catch { throw }
}URL of the site collection to repair
Specific health check rule to run
Off
Display what would happen instead of executing