<#
.SYNOPSIS
    <Overview of script>

.NOTES
    Version        : 1.0
    Author         : Hubert CORNET
    Creation Date  : <Date>
    Purpose/Change : <Initial script development>

.LINK
    https://www.tips-of-mine.fr

.EXEMPLE
    <Example goes here. Repeat this attribute for more than one example>

.DESCRIPTION
    <Brief description of script>

.PARAMETER <Parameter_Name>
    <Brief description of parameter input required. Repeat this attribute if required>

.INPUTS
    <Inputs if any, otherwise state None>

.OUTPUTS
    <Outputs if any, otherwise state None - example: Log file stored in C:\Windows\Temp\<name>.log>
#>

#---------------------------------------------------------[Initialisations]--------------------------------------------------------

# Définir l'action d'erreur pour continuer silencieusement
$ErrorActionPreference = "SilentlyContinue"

# Bibliothèques de fonctions requises

#----------------------------------------------------------[Declarations]----------------------------------------------------------
# Version Script
$sScriptVersion = "1.0"

#Log File Info
$sLogPath = "C:\Tmp"
$sLogName = "Install-Service-RDS.log"
$sLogFile = Join-Path -Path $sLogPath -ChildPath $sLogName

Start-Transcript -Path $sLogFile -NoClobber
#-----------------------------------------------------------[Functions]------------------------------------------------------------

#--------------------------------------------------------[Debut Du Script]---------------------------------------------------------

Add-WindowsFeature RDS-RD-Server -Restart

Import-Module RemoteDesktop
Get-Command -Module RemoteDesktop

New-RDSessionDeployment -ConnectionBroker SRV-RDS-01.it-connect.local -SessionHost SRV-RDS-01.it-connect.local -WebAccessServer SRV-RDS-01.it-connect.local

Add-RDServer -Server SRV-RDS-01.it-connect.local -Role RDS-LICENSING -ConnectionBroker SRV-RDS-01.it-connect.local

Set-RDLicenseConfiguration -LicenseServer SRV-RDS-01.it-connect.local -Mode PerUser -ConnectionBroker SRV-RDS-01.it-connect.local

Get-RDLicenseConfiguration

New-RDSessionCollection -CollectionName "RdsApps" -CollectionDescription "Collection RDS pour accéder aux apps IT-Connect" -ConnectionBroker SRV-RDS-01.it-connect.local -SessionHost SRV-RDS-01.it-connect.local

Set-RDSessionCollectionConfiguration -CollectionName "RdsApps" -TemporaryFoldersPerSession $false -TemporaryFoldersDeletedOnExit $false

Set-RDSessionCollectionConfiguration -CollectionName "RdsApps" -DisconnectedSessionLimitMin 360 -IdleSessionLimitMin 120

Get-RDSessionCollectionConfiguration -CollectionName "RdsApps" -Connection

New-RDRemoteApp -Alias WordPad -DisplayName WordPad -FilePath "C:\Program Files\Windows NT\Accessories\wordpad.exe" -ShowInWebAccess 1 -CollectionName "RdsApps" -ConnectionBroker SRV-RDS-01.it-connect.local

#---------------------------------------------------------[Fin Du Script]----------------------------------------------------------

Stop-Transcript