Back to DevOps Series
PowerShell :

PowerShell :

1. What is PowerShell?

PowerShell is Windows’ modern and powerful command-line shell used for automation and scripting.
It is much stronger than CMD because it can:
  • automate tasks
  • manage servers
  • work with files, processes, services
  • connect to Cloud (Azure, AWS)
  • run advanced scripts

2. Why DevOps Engineers Must Know PowerShell

PowerShell is used for:
✔ Windows server administration
✔ Automation tasks
✔ Cloud automation (especially Azure)
✔ CI/CD pipelines
✔ Managing services, processes, users
✔ Writing scripts to remove manual work
PowerShell = CMD + superpowers.

3. PowerShell Commands Are Called “Cmdlets”

Cmdlets follow this format:
Verb-Noun
Examples:
Get-Process
Get-Service
Get-ChildItem
Stop-Process
Restart-Computer
Very easy to read and understand.

4. Basic PowerShell Commands (Just the essentials)

📌 List files

Get-ChildItem

📌 Change directory

Set-Location foldername

📌 Create folder

New-Item -ItemType Directory -Name test

📌 Remove file

Remove-Item file.txt

📌 Show running processes

Get-Process

📌 Stop a process

Stop-Process -Name notepad -Force

5. PowerShell Scripts (.ps1)

PowerShell scripts use the .ps1 extension.
Example:
Write-Output "Hello DevOps!"
Run script:
.\hello.ps1

6. Execution Policy (Very Important)

PowerShell may block scripts for security.
To allow script execution:
Set-ExecutionPolicy RemoteSigned
Check current policy:
Get-ExecutionPolicy

PowerShell is now the main shell for Windows automation.

8. When Should You Use PowerShell?

Use PowerShell when you need:
  • automation
  • scripting
  • cloud commands
  • server management
  • DevOps tasks
  • working with JSON, APIs, files
CMD is for basics.
PowerShell is for real work.