Commands › SharePoint Online

New-SPOTenantApplyFileVersionPolicyJob

SharePoint Online Microsoft.Online.SharePoint.PowerShell New-*

Queues a job to apply the tenant-level file version policy across all sites. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. > [!NOTE] > This feature is currently in preview and may not be available in your tenant.

Quick start script

# New-SPOTenantApplyFileVersionPolicyJob — 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-SPOTenantApplyFileVersionPolicyJob
$before | Format-List

# 3. Make the change (dry run first)
New-SPOTenantApplyFileVersionPolicyJob -CollectVersionData <SwitchParameter> -VersionPolicy <SPOFileVersionPolicySettings> -WhatIf
New-SPOTenantApplyFileVersionPolicyJob -CollectVersionData <SwitchParameter> -VersionPolicy <SPOFileVersionPolicySettings>

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

Syntax — 3 parameter sets

WithExistingVersionPolicy (Default)

New-SPOTenantApplyFileVersionPolicyJob [-TrimVersions] [-SetVersionPolicy] [-WhatIf] [-Confirm]
 [<CommonParameters>]

WithVersionPolicy

New-SPOTenantApplyFileVersionPolicyJob [-TrimVersions] -VersionPolicy <SPOFileVersionPolicySettings>
 [-WhatIf] [-Confirm] [<CommonParameters>]

CollectData

New-SPOTenantApplyFileVersionPolicyJob [-CollectVersionData] [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters (6)

ParameterTypeRequiredWhat it controls
-Confirm SwitchParameter Prompts you for confirmation before running the cmdlet.
-SetVersionPolicy SwitchParameter Sets version policy for existing document libraries across all sites based on the tenant-level file version policy. The version policy applies to new versions created in these existing document libraries.
-CollectVersionData SwitchParameter yes Collects version data across all sites for use with `Get-SPOTenantApplyFileVersionPolicyJobImpact`. Use this switch to run a data-collection pass before deciding whether and how to trim versions. The job does not...
-TrimVersions SwitchParameter Trims existing versions for files in document libraries across all sites based on the tenant-level file version policy.
-VersionPolicy SPOFileVersionPolicySettings yes The new version policy to apply to the tenant before starting the job. When specified, the tenant-level policy is always updated and the version policy is propagated to all sites. Optionally combine with...
-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.