Search code examples
powershellrds

Install RDS with Powershell on local server


I'm pretty new to Powershell and wanted to create a script that install the Remote Desktop Service which is a prerequisite of my application. (I'm on R2012 btw)

I already found that it's possible to do so with a domain account on a remote server (due to the restart needed during installation). I used:

New-RDSessionDeployment [-ConnectionBroker] <String> [-SessionHost] <String[]> [[-WebAccessServer] <String> ]

Now, I want to install RDS on my local server when I launch my Powershell script (as I can do with the Server Manager GUI). The goal is to install RDS and my application in the same Powershell script without the need to do it using a remote server.

Is it possible to do so ? Should I use the role-based RDS installation or is there any tricks I can use to bypass the local server restart (like maybe a workflow) ?


Solution

  • You just need to add the RDS Feature

    Add-WindowsFeature –Name RDS-RD-Server –IncludeAllSubFeature -Restart
    

    If you don't include -Restart the restart is not performed - but will be needed before the feature can be used.