This cmdlet is part of the Vexasoft Cmdlet Library. You can download it now or click here to find out more.

Set-RemoteDesktopConfig

Synopsis

Configures Remote Desktop settings and requirements on a local or remote computer.

Syntax

  • Set-RemoteDesktopConfig [-Enable] [-RequireNLA] [-AllowOlderClients] [-ConfigureFirewall] [-ComputerName] [-Credential]
  • Set-RemoteDesktopConfig [-Disable] [-ConfigureFirewall] [-ComputerName] [-Credential]

Description

The Set-RemoteDesktopConfig cmdlet is used to configure the requirements for Remote Desktop connections on the local or a remote computer. Remote Desktop access can be enabled or disabled and, in Windows Vista or higher, the Windows Firewall configured accordingly. Network Level Authentication requirements can also be configured for Windows Vista and higher, using the RequireNLA or AllowOlderClients parameters.

Parameters

  • Enable Enable remote desktop access on the specified computer. This parameter cannot be used when the Disable parameter has been specified.
  • Disable Disable remote desktop access on the specified computer. This parameter cannot be used when the Enable parameter has been specified.
  • RequireNLA Require Network Level Authentication from clients attempting to access the computer. This parameter cannot be used when the AllowOlderClients parameter has been specified. This parameter can only be used against Windows Vista and Windows 2008 operating systems or higher.
  • AllowOlderClients Require Network Level Authentication from clients attempting to access the computer. This parameter cannot be used when the AllowOlderClients parameter has been specified. This parameter can only be used against Windows Vista and Windows 2008 operating systems or higher.
  • ConfigureFirewall Configure the firewall in line with whether remote desktop access is enabled on the computer. This parameter can only be used against Windows Vista and Windows 2008 operating systems or higher.
  • ComputerName The computer against which to run the cmdlet. By default this parameter will be populated with the name of the local computer.
  • Credential The credentials under which to run the cmdlet. By default this cmdlet will run as the current user. Using this parameter and the Get-PSCredential cmdlet you can specify an alternate set of credentials under which to execute this command.

Inputs

Set-RemoteDesktopConfig accepts pipeline input only for the ComputerName parameter and requires that the input object contain a property named either Computer, CN or ComputerName.

Outputs

Set-RemoteDesktopConfig makes changes directly to Windows and does not output any Powershell objects.

Notes

The Set-RemoteDesktopConfig cmdlet requires that the RPC service is started on the computer it is trying to access and that DNS services are available to resolve target host names.

Example 1

This command will Enable RemoteDesktop logins on the local computer:

Set-RemoteDesktopConfig -Enable

Example 2

This command will Enable RemoteDesktop logins on the remote computer Serv01. It also requires that clients connecting to the remote desktop of Serv01 use Network Level Authentication. Network Level Authentication can be enabled for older clients using the Enable-ClientNLA cmdlet. Vista clients and higher have NLA enabled by default:

Set-RemoteDesktopConfig -Enable -RequireNLA -Computer Serv01

Example 3

The Get-RemoteDesktopConfig cmdlet can be used in conjunction with the Set-RemoteDesktopConfig cmdlet. In this example, Get-RemoteDesktop is used to retrieve the remote desktop settings on computer Serv1 and replicate them on Serv02:

Get-RemoteDesktopConfig -Computer Serv01 | Set-RemoteDesktopConfig -Computer Serv02

Example 4

In this command remote desktop is enabled on the local computer and the Windows Firewall configured to allow remote desktop connections:

Set-RemoteDesktopConfig -Enable -ConfigureFirewall

Example 5

In this command remote desktop is disabled on the local computer and the Windows Firewall configured to block remote desktop connections:

Set-RemoteDesktopConfig -Disable -ConfigureFirewall