List of commands: https://www.pdq.com/powershell/. PowerShell, Powercat & Nishang
Common Commands + Alias + Table
<aside> 💡 Google for cmdlet or function Eg: Get-Command > goto #notes for summary and alias.
</aside>
Some commands that you might require on daily basis as a beginner for Pentesting.
Help menu -
Get-Help <Command>
orhelp <command>
orman <command>
(PS treatsman
same ashelp
) e.g.help New-Object
, (Look REMARKS for more commands) -
Grep -
Select-String
orsls
e.g. To find short alias of commands, alias ofGet-Alias
isgal
:gal > shorts.txt
thencat shorts.txt | sls "gal"
outputsGet-Alias
.
Calculate no of lines from a file: Length() method to retrive no of lines
(gc D:\\Temp\\commands.csv).Length
(gc
is Get-Content
, other alias are cat
& type
)
List all commands: E.g. listing only cmdlets - gcm -CommandType Cmdlet
(gcm
is Get-Command
) and (gcm -CommandType Cmdlet).Length
outputs 6638
: no of cmdlets in PS.
Current Working Location: pwd
or gl
or Get-Location
.
Test if Path esists: Test-Path "C:\\Users\\Administrator\\Documents\\Passwords"
Alternate for other OSes - shasum
(mac), md5
(mac), sha256sum
(linux), md5sum
(linux)
Get-FileHash D:\\Temp\\file.txt -Algorithm MD5
E.g. and Get-FileHash
help menu.