documentation-dsit/docs/Services/Gestion des arrivées-départs/eleves/creation-mail.ps1
2023-09-28 14:35:51 +02:00

23 lines
474 B
PowerShell

$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