PowerShell

PowerShell is a powerful scripting language and command-line shell developed by Microsoft for automating administrative tasks and managing computer systems.

Getting Start

% = foreach
$_ = current object 
example: 1,2,3,4 | % {$_+3} 
result : 4,5,6,7 
? = where
eq = equal
ne = not equal
like = similar/comparable
gt = greater than
lt = less than
example: Get-Service | ? {$_.Status -ne "Running"} 
select = Select-Object
example: Get-Service dhcp | select ServiceName CanPauseAndContinue,DisplayName

sls = Select-String
example: ls -r <path> -File *.txt | %{ sls -Path $_ -Pattern pass* }
Module:
C:\$Env:PsModulePath
all modules in this path are imported automatically

Get-Command -Module <module name>

Download Files

Some Examples:

New-Object:

Invoke-Expression:

System.xml.XmlDocument:

+Stealthy

Some usage Examples

Cmdlets associated with the process:

Cmdlets associated with "Set":

4th process using more memory:

Simple PortScan:

Last updated