Jump to content

Exchange Powershell Script for Setting Default Language


Recommended Posts

Posted

Hi,

 

Need to set default language for only student users using powershell. I have used the script to set individually and this works but need to do on mass for about 1300 users.

  • 1 month later...
Posted

Is this for Outlook Web App, Live@Edu or something else? :confused:

 

Depending upon what you are trying to do you may be able to modify one of the scripts below.

 

Get-Mailbox -OrganizationalUnit "OU=students,DC=server1,DC=school,DC=net" -ResultSize unlimited | Set-MailboxRegionalConfiguration -Language en-GB -TimeZone "GMT Standard Time"

 

'Reading Mailboxes...'
$boxes = Get-Mailbox -OrganizationalUnit Students -ResultSize unlimited

'Setting Mailboxes...'
foreach ($box in $boxes)
 {
 $box
 $box | Set-MailboxRegionalConfiguration -Language en-GB -TimeZone "GMT Standard Time"
 }
$boxes | Get-MailboxRegionalConfiguration | Format-Table

'Done.'

 

# Source: http://universitytechnology.blogspot.com/2010/11/powershell-update-timezone-region-for.html

# Set Variables
$ImportFile = "D:\Students.csv"
$Language = "en-GB"
$Timezone = "GMT Standard Time"
$DateFormat = "dd/mm/yyyy"
$TimeFormat = "h:mm tt"

# Get the e-mail accounts to change
$EmailAccounts = import-csv $ImportFile
Write-Host "Accounts Found in CSV File" $EmailsToCheck.Length

if ($EmailsToCheck.Length -gt 0) {
 ## Setup Outlook Session Session and modify accounts
 $LiveCred = Get-Credential
 $loop = 5
 while($loop -gt 0) {
   # this loops handles reconnect if connection to Live fails on first try.
   $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
   if($Session) { 
     $loop = 0
     Import-PSSession $Session
     $EmailAccounts | foreach {
       $Check = Get-MailboxRegionalConfiguration $_.email
       if($Check -ne $Timezone) {
         Write-Host $_.email
         Set-MailboxRegionalConfiguration $_.email -TimeZone $Timezone -Language $Language -DateFormat $DateFormat -TimeFormat $TimeFormat
       }
     }
   } else {
     Write-Host "Session not created... trying again"
     $loop -= 1
   }
 }
}
Remove-PSSession $Session.Id

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...