Un exemple de script pour ajouter une adresse email supplémentaire aux utilisateurs de Live@Edu
Set-ExecutionPolicy RemoteSigned
$cred = Get-Credential
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $session
# Ajout deuxieme email
$users = Get-mailbox
foreach ($a in $users) {$a.emailaddresses.Add("$((get-user -Id $a.alias).FirstName.Replace(" ","-").Replace("é","e").Replace("ë","e").Replace("ï","i").Replace("î","i").Replace("è","e").tolower()).$((get-user -Id $a.alias).LastName.Replace(" ","-").Replace("é","e").Replace("ë","e").Replace("ï","i").Replace("î","i").Replace("è","e").tolower())@monecole.fr")}
$users | %{Set-Mailbox $_.Identity -EmailAddresses $_.EmailAddresses}