Firewall with Powershell Cheat Sheet

Reset Git Branch Commits

Firewall with Powershell Cheat Sheet for use with powershell task automation framework.

Firewall

Enable ICMP

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow

Enable Specific Port

netsh advfirewall firewall add rule name="Open Port 80" dir=in action=allow protocol=TCP localport=80

Bypass Proxy during Web Client call

$wc = new-object System.Net.WebClient
$wc.Headers.Add("user-agent", "PowerShell Script")
$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

Bypass TLS validation during Web Client call

$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

$wc = New-Object System.Net.WebClient
$wc.DownloadString("https://...")
Marcin Narloch

Marcin Narloch

Creative and out-of-the-box thinker with strong interests and knowledge in technology and innovation.
Reset Git Branch Commits Previous post Minecraft Players Cheat Sheet
Reset Git Branch Commits Next post SSH Cheat Sheet

Leave a Reply

Your email address will not be published. Required fields are marked *