functions/Enable-RDP.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<#
.SYNOPSIS Enable Remote Desktop remotely .EXAMPLE Enable-RDP -ComputerName test-1 #> function Enable-RDP { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string[]]$ComputerName, [string]$UserName ) process { Invoke-Command -ComputerName $ComputerName -ScriptBlock { Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name 'fDenyTSConnections' -Value 0 Netsh advfirewall firewall set rule group='remote desktop' new enable=yes } } } |