$login = $args[0];
$email = $args[1];
$alias = $args[2];

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://sp-exch01.ensae.fr/PowerShell/ -Authentication Kerberos
Import-PSSession $Session -DisableNameChecking -AllowClobber | Out-Null

try {


Enable-Mailbox -Identity $login -Database "DB01_ELEVES-SP-EXCH01" -Alias $login -PrimarySmtpAddress $email | Out-Null
write-host "0"

}

catch {


write-host "1"

}
Remove-PSSession $Session
