Skip to content

Power Shell

  • Object Based, Scripting Language for Windows..
  • Open Source and cross platfrom with PS Pro
  • Based on .NET and Specially Designed for Windows Admins etc..
  • security features.. controls how config files loads
  • Execution policies for the current user stored in Registry…
  • Policies are specific session and destroyed after it.. → stored in Memory..
  • it is NOT a security Guard → means we can easily bypass security policies..
    • But they define basic rules on How

image.png

Terminal window
PS C:\Users\PavanKumarBandaru> Set-ExecutionPolicy -ExecutionPolicy bypass -Scope LocalMachine
PS C:\Users\PavanKumarBandaru> Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Bypass
PS C:\Users\PavanKumarBandaru> Get-ExecutionPolicy
Bypass
PS C:\Users\PavanKumarBandaru> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
PS C:\Users\PavanKumarBandaru> Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine RemoteSigned
Terminal window
PS C:\WINDOWS\system32> Get-Process "brave"
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
359 26 36460 91132 0.69 5328 1 brave
280 20 15292 30220 17.30 5356 1 brave
419 26 27140 58348 49.59 9840 1 brave
202 13 7056 14140 0.17 10184 1 brave
1751 79 140376 269484 363.34 10248 1 brave
755 60 443244 395480 789.22 11540 1 brave
220 17 14372 26396 1.28 13332 1 brave
408 45 291156 368728 104.23 15440 1 brave
242 21 20168 39852 0.30 17080 1 brave
358 39 191792 255484 150.50 19724 1 brave
560 32 58536 54256 1.52 20180 1 brave
429 31 76432 143008 3.67 26912 1 brave

Bypassing Script Privilages..

image.png

Commands

Variables & Arrays & Hash Table/Dict.

Properties & Methods

Class and Objects

Strings

Conditionals, Operators & Regex

Pipelines

Providers

Data Files [CSV, XML, JSON, YAML]

WMI & CIM

Functions