I recently discovered while poking around in the change the look settings of a team site that it was possible to have horizontal navigation just like a communication site. This has been an annoyance for my users as the change between horizontal and vertical navigation can be very jarring if they don't know the rules of what gets a team site and what gets a communication site.

Enter the horizontal nav and mega menu everywhere script.

You will need to be a site admin on all the sites you are changing, I have included a bit in the beginning to grant yourself secondary admin on all sites without adding you as a member of a team. Make sure to run that by HR or whatever process you need to before doing it.

Github

<#
    Jake Cross
    9-24-22
    Set horizontal nav and mega menu everywhere
#>
Import-Module PnP.PowerShell
Connect-PnPOnline -UseWebLogin -Url "https://domain.sharepoint.com"
# Get all sites in tenant
$Sites = Get-PnPTenantSite
foreach ($site in $sites) {
    # Set user as secondary admin on all sites without adding them to a team
    Set-PnPTenantSite -Url $site.url -owners "user@domain.com"
}
Disconnect-PnPOnline
# Activate Communication Site style navigation on all sites
foreach ($Site in $Sites) {
    Connect-PnPOnline -UseWebLogin -Url $Site.url
    $Web = Get-PnPWeb
    $web.MegaMenuEnabled = $true
    $Web.HorizontalQuickLaunch = $true
    $Web.Update()
    Invoke-PnPQuery
    Disconnect-PnPOnline
}