Basic Command
The basic of Command Prompt and PowerShell
This note was created when I was not very familiar with the Windows environment. I didn't know how to restart the machine from the command line, copy files, or import PowerShell scripts, etc.
Basic PowerShell
Enter powershell with Execution Policy Bypass
powershell -ep bypassOr, if you already inside powershell session, you can set Execution Policy with this command:
Set-ExecutionPolicy Bypass -Scope CurrentUserLoad powershell script function into memory with dot sourcing:
. .\PowerView.ps1Import module to powershell:
import-module .\Powerspolit.psd1Check All Available Powershell Command
Get-Command -Name "*Invoke*"
Get-Command
Copy & Move
How to copy file:
How to copy directory:
Explanation:
/Eβ Copies all subdirectories, including empty ones./Iβ If the destination does not exist and copying more than one file, this option assumes that the destination must be a directory./Yβ Suppresses prompting to confirm you want to overwrite an existing destination file.
How to Move File or Directory
Rename
Sometimes, after found service run as SYSTEM user and writable by low user, you can drop payload to the directory and rename the payload to match the service name.
Download
certutil.exe
powershell.exe: Invoke-WebRequest
Download and Execute
powershell.exe: Invoke-Expression
Or, from cmd.exe to powershell.exe
Or, use start /B to run the command in background.
Restart and Shutdown
Shutdown now:
Restart now:
Convert to Base64
Privileges, User, and Groups
User stuff:

Check Local Group using Command Prompt:
Check group member

Last updated
Was this helpful?