if($psISE){
    $ThisScript = Get-ChildItem $psISE.CurrentFile.FullPath
}
else{
    $ThisScript = Get-ChildItem $PSCommandPath
}

Write-Host "Téléchargement d'Outlook dans $($ThisScript.DirectoryName)\Office\Data..." -ForegroundColor Cyan

try{
    Start-Process -FilePath "$($ThisScript.DirectoryName)\Setup.exe" -ArgumentList "/download OutlookLTSC.xml" -Verb RunAs -Wait -ErrorAction Stop
}
catch{
    Write-Warning $_
}


Write-Host "Lancement de l'installation d'Outlook..." -ForegroundColor Cyan

try{
    Start-Process -FilePath "$($ThisScript.DirectoryName)\Setup.exe" -ArgumentList "/configure OutlookLTSC.xml" -Verb RunAs -ErrorAction Stop
}
catch{
    Write-Warning $_
}

sleep 3

exit
