Commands › SharePoint Online

Set-SPOSiteArchiveState

SharePoint Online Microsoft.Online.SharePoint.PowerShell Set-*

Sets the archived state of the site. Can be used to archive and reactivate sites.

Quick start script

# Set-SPOSiteArchiveState — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-SPOService -Url https://$org-admin.sharepoint.com

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-SPOSiteArchiveState
$before | Format-List

# 3. Make the change (dry run first)
Set-SPOSiteArchiveState -ArchiveState <SPOArchiveState> -Identity <SpoSitePipeBind> -WhatIf
Set-SPOSiteArchiveState -ArchiveState <SPOArchiveState> -Identity <SpoSitePipeBind>

# 4. Verify and diff
$after = Get-SPOSiteArchiveState
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

Set-SPOSiteArchiveState [-Identity] <SpoSitePipeBind> [-ArchiveState] <SPOArchiveState> [-NoWait] [-Force]
 [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters (6)

ParameterTypeRequiredWhat it controls
-ArchiveState SPOArchiveState yes Sets the archived state of the site. Valid values are Archived, Active.
-Force SwitchParameter Whether to set the site archived state without prompting for confirmation.
-Identity SpoSitePipeBind yes Identity of the site to archive or reactivate.
-NoWait SwitchParameter Whether to not wait for the operation to complete.
-Confirm SwitchParameter Prompts you for confirmation before running the cmdlet.
-WhatIf SwitchParameter Shows what would happen if the cmdlet runs. The cmdlet is not run.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.