PowerShell Basics

2025. 3. 21. 19:27·Study Record/Cybersecurity
목차
  1. 1. PowerShell
  2. 2. PowerShell Syntax
  3. 3. PowerShell Execution Policies
  4. 4. Running PowerShell Scripts
  5. 5. Working with Processes
  6. 6. Working with Services
  7. 7. File System Commands

1. PowerShell

- Command-line shell and scripting language built into Windows

- Unlike the traditional cmd, PowerShell can:

1) work with objects instead of just text

2) interact directly with the Windows API and registry

3) execute powerful scripts and modules

 

2. PowerShell Syntax

- PowerShell commands are called cmdlets

- They always follow the Verb-Noun format

Get-Process      # Lists running processes
Get-Service      # Shows active services
Get-Command      # Displays all available PowerShell commands
Get-Help Get-Service -Full   # Shows detailed documentation

 

3. PowerShell Execution Policies

- PowerShell scripts (.ps1 files) don't run by default due to security policies

- Check the current execution policy:

Get-ExecutionPolicy

 

- Possible output:

Restricted  # Scripts are not allowed to run (default)
RemoteSigned  # Only scripts from the internet need to be signed
Unrestricted  # All scripts can run without restrictions (dangerous)

 

- Change execution policy to allow script execution:

Set-ExecutionPolicy Unrestricted -Scope CurrentUser

 

4. Running PowerShell Scripts

 

- execute a script in the current directory:

.\script.ps1

 

- run a script from an absolute path:

C:\Users\YourUser\Desktop\script.ps1

 

- if the execution policy blocks it, use:

powershell -ExecutionPolicy Bypass -File script.ps1

 

5. Working with Processes

- List running processes:

Get-Process

 

- Stop a process:

Stop-Process -Name chrome -Force

 

- Start a new process:

Start-Process notepad

 

6. Working with Services

- List all services:

Get-Service

 

- Check if a specific service is running:

Get-Service -Name Spooler

 

- Stop a service:

Stop-Service -Name Spooler -Force

 

- Start a service:

Start-Service -Name Spooler

 

7. File System Commands

 

- Navigate directories: (same as cd in Linux)

Set-Location C:\Users

 

- List files and folder:

Get-ChildItem

 

- Create a new file:

New-Item -Path "C:\Users\YourUser\Desktop\test.txt" -ItemType File

 

- Delete a file:

Remove-Item C:\Users\YourUser\Desktop\test.txt

 

  1. 1. PowerShell
  2. 2. PowerShell Syntax
  3. 3. PowerShell Execution Policies
  4. 4. Running PowerShell Scripts
  5. 5. Working with Processes
  6. 6. Working with Services
  7. 7. File System Commands
'Study Record/Cybersecurity' 카테고리의 다른 글
  • HKCU vs HKLM
  • PowerShell for Security & Privilege Escalation
  • Privilege Escalation Techniques in AWS
  • [HTB Academy] Password Attacks Lab - Easy writeup
Sungyeon Kim
Sungyeon Kim
goldstaryeon@sookmyung.ac.kr
Sungyeon Kimgoldstaryeon@sookmyung.ac.kr
Sungyeon Kim
Sungyeon Kim
Sungyeon Kim
전체
오늘
어제
  • 분류 전체보기 (605)
    • Paper Review (30)
    • Research Record (9)
    • Study Record (143)
      • Cybersecurity (79)
      • AI Data Science (28)
      • Computer Science (24)
      • Linear Algebra (6)
      • SQL (5)
      • LaTeX (1)
    • English Transcription (256)
    • 한글 필사 (91)
    • 날것 그대로의 생각들 (72)

인기 글

최근 댓글

최근 글

hELLO· Designed By정상우.v4.5.3
Sungyeon Kim
PowerShell Basics
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.