For current site, you could disable versioning settings for all document libraries in a site collection by using following PowerShell.
Note: Replace site URL with your site.
#Function to Disable Versioning on All Document Libraries in a SharePoint Online Site
Function Disable-SPOVersionHistory()
{
param
(
[Parameter(Mandatory=$true)] [string] $SiteURL
)
Try {
Write-host -f Yellow "Processing site:"$SiteURL
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Global:Credentials
#Get the site, subsites and lists from given site
$Web = $Ctx.web
$Ctx.Load($Web)
$Ctx.Load($Web.Lists)
$Ctx.Load($web.Webs)
$Ctx.executeQuery()
#Array to exclude system libraries
$SystemLibraries = @("Form Templates", "Pages", "Preservation Hold Library","Site Assets", "Site Pages", "Images",
"Site Collection Documents", "Site Collection Images","Style Library")
#Get All document libraries
$DocLibraries = $Web.Lists | Where {$_.BaseType -eq "DocumentLibrary" -and $_.Hidden -eq $False -and $_.Title -notin $SystemLibraries}
ForEach($Library in $DocLibraries)
{
#disable versioning in each document library
$Library.EnableVersioning = $False
$Library.Update()
$Ctx.ExecuteQuery()
Write-host -f Green "`tVersioning has been turned OFF at '$($Library.Title)'"
}
#Iterate through each subsite
ForEach ($Subweb in $Web.Webs)
{
#Call the function recursively
Disable-SPOVersionHistory($Subweb.url)
}
}
Catch {
write-host -f Red "Error:" $_.Exception.Message
}
}
#Set Parameters
$SiteURL="https://tenant.sharepoint.com/sites/marketing"
#Get Credentials to connect
$Cred= Get-Credential
$Global:Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Call the function to disable versions on all document libraries
Disable-SPOVersionHistory -SiteURL $SiteURL
For new site, you need to set version history limit in the tenant level.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.