Last active
June 11, 2019 16:07
-
-
Save thiagoeh/c845aef6e3c3372dcac29eaa876401fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Direct connection | |
| # @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/thiagoeh/c845aef6e3c3372dcac29eaa876401fc/raw'))" | |
| # With proxy | |
| # @powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials; iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/thiagoeh/c845aef6e3c3372dcac29eaa876401fc/raw'))" | |
| Write-Output "Duplicating default RDP listener" | |
| Copy-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Destination "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-3007-Tcp" -Recurse | |
| Write-Output "Setting port value 3007 for the new listener" | |
| Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-3007-Tcp" -Name PortNumber -Value 3007 | |
| Write-Output "Opening-up TCP 3007 in the firewall" | |
| New-NetFirewallRule -DisplayName "Inbound TCP 3007" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3007 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment