Created
December 21, 2018 14:49
-
-
Save SevenLayerJedi/7f1c362edb84c49ed0d6944e54219fab to your computer and use it in GitHub Desktop.
This file contains 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
# Commands to allow/disallow through Windows Firewall | |
# NETSH | |
netsh firewall set service type = remotedesktop mode = enable | |
# Registry | |
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f | |
# PowerShell | |
$FireWall = New-Object -comObject HNetCfg.FwPolicy2 | |
$EnableRules = $FireWall.rules | Where-Object {$_.LocalPorts -like "*3389*" -and $_.Profiles -eq "3"} | |
ForEach ($Rule In $EnableRules){($Rule.Enabled = "True")} | |
# Where 1 (Domain networks) + 2 (Private networks) = 3 | |
# Figured out what the properties and methods are | |
$FireWall | Get-Member | |
$Rules | Get-Member |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment