Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Enable Remote Desktop

$
0
0

Hi,

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?

    http://blogs.technet.com/b/jamesone/archive/2009/01/31/checking-and-enabling-remote-desktop-with-powershell.aspx

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

    (Get-WmiObjectwin32_TerminalServiceSetting -Namespaceroot\cimv2\TerminalServices).SetAllowTSConnections(1)
    2
    3import-modulenetsecurity -eastop ; Get-NetFirewallRule| ? {$_.displayname -like"remote desktop*"} | Set-NetFirewallRule-enabledtrue

    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?

    Thanks,

    Nigel.


    Viewing all articles
    Browse latest Browse all 6937

    Trending Articles