Enable Remote Desktop

by Aug 12, 2012


Just starting to take a look at Server 2012 and I'm trying my best to use powershell as much as possible…

I simply want to enable remote desktop so I can RDP to the server.

Get-Command *Remote* brings back several commands including Set-RDRemoteDesktop but that doesn't appear to be what I want.

Get-Command *Desktop* does not appear to help

Get-Command *Enable* does not appear to help

I go back to google and find the following

  • Set-RemoteDesktop [-Enable] [-RequireNLA] [-AllowOlderClients] [-ConfigureFirewall] [-ComputerName] [-Credential]
  • Set-RemoteDesktop [-Disable] [-ConfigureFirewall] [-ComputerName] [-Credential]
  • Great I think I'm there but these are 3rd party cmdlets ….

    I do some more searching and find that a function has been written but I assume there should be something built in and I guess the following would not enable the relevant firewall rules?


    I do a bit more searching and find the following but again surely there must be a simpler way?

    (Get-WmiObject win32_TerminalServiceSetting -Namespace rootcimv2TerminalServices).SetAllowTSConnections(1)
    3 import-module netsecurity -ea stop ; Get-NetFirewallRule | ? {$_.displayname -like "remote desktop*"} | Set-NetFirewallRule -enabled true

    So after several hours at my first attempt to run (what I assumed would be a simple task) a command in powershell I seem to have failed.

    I've ended up using the GUI which took me 10 seconds ….

    What am I doing wrong? Is there a simpler solution?