Public/Configuration/Set-MailboxDefaultLanguage.ps1
function Set-MailboxDefaultLanguage { param( [Parameter(Mandatory)] [string]$TenantId ) try { Write-ModuleLog -Message "Setting default language for tenant $TenantId" -Level Info -Component 'Set-MailboxDefaultLanguage' Connect-CustomerExchange -CustomerTenantId $TenantId get-exomailbox | Where-Object Name -NotLike 'Discovery*' | ForEach-Object { $mail = $_.UserPrincipalName $lang = (Get-MailboxRegionalConfiguration -Identity $mail).Language if ( $lang -ne 'da-DK' ) { Write-ModuleLog -Message "Changing language to danish for $mail" -Level Info -Component 'Set-MailboxDefaultLanguage' Set-MailboxRegionalConfiguration -Identity $mail -Language da-DK -DateFormat "dd-MM-yyyy" -TimeFormat "HH:mm" -LocalizeDefaultFolderName -TimeZone "Romance Standard Time" } } } catch { throw $_ } } |