Skip to content

Instantly share code, notes, and snippets.

@Sporax
Sporax / netsh.md
Created February 13, 2019 18:03
Cheat sheet to set windows firewall using powershell or netsh

Netsh

enable/disable firewall

netsh advfirewall set [privateprofile|publicprofile|domainprofile|currentprofile] state [on|off]

set default firewall action

netsh advfirewall set [privateprofile|publicprofile|domainprofile|currentprofile] firewallpolicy [allowinbound|blockinbound|blockinboundalways|notconfigured],[allowoutbound|blockoutbound|notconfigured]

add rule

netsh advfirewall firewall add rule name="My Application" dir=in action=allow program="C:\MyApp\MyApp.exe" enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=domain

@Sporax
Sporax / wmic.md
Created February 13, 2019 18:06
WMIC cheat sheet

WMIC

computer name:

wmic computersystem get "Name"

processes:

wmic process

processor name:

wmic CPU get Name

@Sporax
Sporax / simplescript.ps1
Created February 13, 2019 18:07
Simple powershell script to ping or do math
Write-Host "Choose between these options:"
Write-Host
Write-Host "1. See a list of processes on the system"
Write-Host "2. See a list of services on the system"
Write-Host "3. Send a ping"
Write-Host "4. Double a number"
$userinput = Read-Host
if ( $userinput -eq "1") {